I have the following object for configuration and code, but when the grid renders, the column headers look fine...but the rows show up as a single row of "undefined" repeated for each entry. Please help.
configuration object:
{"dataSource":{"data":[{"s":"http://en.wikipedia.org/wiki/Une_Histoire_de_vent","o":"en","p":"http://purl.org/dc/elements/1.1/language","id":0},{"p":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type","s":"http://en.wikipedia.org/wiki/Une_Histoire_de_vent","o":"http://xmlns.com/foaf/0.1/Document","id":1},{"o":"http://dbpedia.org/resource/Une_Histoire_de_vent","s":"http://en.wikipedia.org/wiki/Une_Histoire_de_vent","p":"http://xmlns.com/foaf/0.1/primaryTopic","id":2},{"p":"http://www.w3.org/2002/07/owl#someValuesFrom","s":"b0","o":"http://www.w3.org/2006/03/wn/wn20/schema/AdverbWordSense","id":3},{"s":"b0","o":"http://www.w3.org/2006/03/wn/wn20/schema/containsWordSense","p":"http://www.w3.org/2002/07/owl#onProperty","id":4},{"p":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type","o":"http://www.w3.org/2002/07/owl#Restriction","s":"b0","id":5},{"o":"http://xmlns.com/foaf/0.1/Document","s":"http://en.wikipedia.org/wiki/2006_White_House_Correspondents'_Association_Dinner","p":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type","id":6},{"p":"http://purl.org/dc/elements/1.1/language","s":"http://en.wikipedia.org/wiki/2006_White_House_Correspondents'_Association_Dinner","o":"en","id":7},{"p":"http://xmlns.com/foaf/0.1/primaryTopic","s":"http://en.wikipedia.org/wiki/2006_White_House_Correspondents'_Association_Dinner","o":"http://dbpedia.org/resource/2006_White_House_Correspondents'_Association_Dinner","id":8},{"o":"http://www.w3.org/2006/03/wn/wn20/schema/WordSense","s":"b1","p":"http://www.w3.org/2002/07/owl#someValuesFrom","id":9}],"pageSize":25,"schema":{"model":{"fields":[{"s":{"type":"string"}},{"p":{"type":"string"}},{"o":{"type":"string"}}]}}},"height":400,"scrollable":true,"sortable":true,"filterable":true,"pageable":{"input":true,"numeric":false},"columns":[{"field":"s","title":"s"},{"field":"p","title":"p"},{"field":"o","title":"o"}]}
And here is my code:
var columns = [];
var fields = [];
$.each(data.results.head.vars, function(index, value) {
columns.push({'field': value, 'title': value});
var to = {};
to[value] = {type: "string"};
fields.push(to);
});
var dataBindings = [];
$.each(data.results.results.bindings, function(index1, value) {
var tempobj = {};
$.each(value, function(k1,v1) {
tempobj[k1] = v1.value;
});
tempobj.id=index1;
dataBindings.push(tempobj);
});
console.log(JSON.stringify(dataBindings));
var configuration = {
dataSource: {
data: dataBindings,
pageSize: 25,
schema: {
model: {
fields: fields
}
},
},
height: 400,
scrollable: true,
sortable: true,
filterable: true,
pageable: {
input: true,
numeric: false
},
'columns': columns
};
console.log(JSON.stringify(configuration));
// Create the popup window
var gridWindow = $("#resultsPopup").kendoWindow({
width: "70%",
title: "Graph Results",
actions: [
"Minimize",
"Maximize",
"Close"
]
}).data('kendoWindow');
gridWindow.center().open();
// Create the grid
var grid = $("#resultsGrid").kendoGrid(configuration).data('kendoGrid');
configuration object:
{"dataSource":{"data":[{"s":"http://en.wikipedia.org/wiki/Une_Histoire_de_vent","o":"en","p":"http://purl.org/dc/elements/1.1/language","id":0},{"p":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type","s":"http://en.wikipedia.org/wiki/Une_Histoire_de_vent","o":"http://xmlns.com/foaf/0.1/Document","id":1},{"o":"http://dbpedia.org/resource/Une_Histoire_de_vent","s":"http://en.wikipedia.org/wiki/Une_Histoire_de_vent","p":"http://xmlns.com/foaf/0.1/primaryTopic","id":2},{"p":"http://www.w3.org/2002/07/owl#someValuesFrom","s":"b0","o":"http://www.w3.org/2006/03/wn/wn20/schema/AdverbWordSense","id":3},{"s":"b0","o":"http://www.w3.org/2006/03/wn/wn20/schema/containsWordSense","p":"http://www.w3.org/2002/07/owl#onProperty","id":4},{"p":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type","o":"http://www.w3.org/2002/07/owl#Restriction","s":"b0","id":5},{"o":"http://xmlns.com/foaf/0.1/Document","s":"http://en.wikipedia.org/wiki/2006_White_House_Correspondents'_Association_Dinner","p":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type","id":6},{"p":"http://purl.org/dc/elements/1.1/language","s":"http://en.wikipedia.org/wiki/2006_White_House_Correspondents'_Association_Dinner","o":"en","id":7},{"p":"http://xmlns.com/foaf/0.1/primaryTopic","s":"http://en.wikipedia.org/wiki/2006_White_House_Correspondents'_Association_Dinner","o":"http://dbpedia.org/resource/2006_White_House_Correspondents'_Association_Dinner","id":8},{"o":"http://www.w3.org/2006/03/wn/wn20/schema/WordSense","s":"b1","p":"http://www.w3.org/2002/07/owl#someValuesFrom","id":9}],"pageSize":25,"schema":{"model":{"fields":[{"s":{"type":"string"}},{"p":{"type":"string"}},{"o":{"type":"string"}}]}}},"height":400,"scrollable":true,"sortable":true,"filterable":true,"pageable":{"input":true,"numeric":false},"columns":[{"field":"s","title":"s"},{"field":"p","title":"p"},{"field":"o","title":"o"}]}
And here is my code:
var columns = [];
var fields = [];
$.each(data.results.head.vars, function(index, value) {
columns.push({'field': value, 'title': value});
var to = {};
to[value] = {type: "string"};
fields.push(to);
});
var dataBindings = [];
$.each(data.results.results.bindings, function(index1, value) {
var tempobj = {};
$.each(value, function(k1,v1) {
tempobj[k1] = v1.value;
});
tempobj.id=index1;
dataBindings.push(tempobj);
});
console.log(JSON.stringify(dataBindings));
var configuration = {
dataSource: {
data: dataBindings,
pageSize: 25,
schema: {
model: {
fields: fields
}
},
},
height: 400,
scrollable: true,
sortable: true,
filterable: true,
pageable: {
input: true,
numeric: false
},
'columns': columns
};
console.log(JSON.stringify(configuration));
// Create the popup window
var gridWindow = $("#resultsPopup").kendoWindow({
width: "70%",
title: "Graph Results",
actions: [
"Minimize",
"Maximize",
"Close"
]
}).data('kendoWindow');
gridWindow.center().open();
// Create the grid
var grid = $("#resultsGrid").kendoGrid(configuration).data('kendoGrid');