javascript - Displaying object inside object in kendo grid -


i new kendo , have problem kendo grid. have structure this

var data = [{     key1: value1,     key2: value2,     objectinside: [{         insidekey1: insidevalue1,         insidekey2: insidevalue2,         insidekey3: insidevalue3     },     {         insidekey1: insidevalue1a,         insidekey2: insidevalue2a,         insidekey3: insidevalue3a     },     {         insidekey1: insidevalue1b,         insidekey2: insidevalue2b,         insidekey3: insidevalue3b     }] }]; 

and need create kendo grid , fill objectinside elements. can display 1 of element of array:

var grid = $("#grid").kendogrid({     pageable: true,     selectable: "row",     datasource: data     columns   : [         { field: "objectinside.insidekey1[0]", title: "value1:" },         { field: "objectinside.insidekey2[0]", title: "value2:" },         { field: "objectinside.insidekey3[0]", title: "value3:" }     ] }).data("kendogrid"); 

but not have idea how reach elements. without indexing doesn't work. possible make loop here? thought making variable contain objectinside , try read element failed here too. try this:

var newdata = data.objectinside; 

or

var newdata = json.stringify(data.objectinside); 

could give me hint how deal it?

try template:

{ template: "#= data.objectinside[0].insidekey1 #", title: "value1" }, { template: "#= data.objectinside[1].insidekey2 #", title: "value2" }, { template: "#= data.objectinside[2].insidekey3 #", title: "value3" } 

demo

but show 1 row, because grid data contains 1 item in first level. can like this show data inside insideobject.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -