Thursday, 15 July 2010

javascript - How can I use nested Json to populate Kendo UI grid? -


How can I populate the cando UI grid with Nested JSON.

I mean, my JSON is like

  var myJson: [{"oneType": [{"id": 1, "name": "John doe"} , {"Id": 2, "name": "don joy"}]}, {"other type": "work"}, {"other type": "xyz"}]}];   

And I want the Cando UI grid with columns as an ID, name, other type and other stuff.

Thanks in advance!

For complex JSON structures, you

  var grid = $ ("# Grid"). {Data: Source: {Data: [{"one type": [{"id": 1, "name": "John doe"}, {"id": 2, "name": "don joh"}] }, {"Other type": "working"}, {"other type": "xyz"}], page size: 10, schema: {parse: function (d) {for (var i = 0; i & Lt; d.length; i ++) {If (d [i] .oneType) {return d [i] .oneType;}} return [];}}}}. Data ("candrog");   

If you change your JSON a bit:

  {"oneType": [{"id": 1, "name": "John Doe You can: "" "" "," name ":" don joeh "}]," other type ":" work "," other content ": "Xyz"} Usage:  
  var grid = $ ("# grid") .cendo grid ({dataSource: {data: {"one type": [{"id": 1, "name "John Doi"}, {"id": 2, "name": "don joeh"}], "other type": "working", "other type": "xyz"}, page size: 10, schema: {data: "one type"}}}). Data ("cando grid");    

No comments:

Post a Comment