I have received the data in json format as follows:
var mydata = [
{
"Title":"My Grid Example",
"NumberOfColumns":4,
"DatasetHeader":{"items":[
{"Name":"FullName","Type":"System.String"},
{"Name":"Age","Type":"System.Int32"},
"Name":"Address","Type":"System.String"},
{"Name":"Cost","Type":"System.Double"}
]},
"Rows":["items":[
{"Rohan","12","Arab","234"},
{"Radha","11","Texas","123"},
{"Haris","22","NPL","344"},
{"Christine","23","Arab","674"},
{"Tot","22","UK","434"},
{"Terry","21","LA","334"},
{"Savana","19","SA","224"}
]}
}];
Now, I want to generate the dynamic grid with the above data with 4 columns and 7 rows (for this case) . The columns can varies during runtime (from 2-3 to 14-15)
Something like this is expected:
<script>
$(document).ready(function () {
generateGrid(mydata);
}
function generateGrid(receiveddata) {
$("#table-grid").kendoGrid({
dataSource: { data: receiveddata.Rows.Items},
height: 400,
scrollable: true,
schema: {
model: receiveddata.DatasetHeader.items
},
title: receiveddata.title
});
} //end of javascript function
</script>
<div id="table-grid"></div>