I'm using ServerGrouping, I can group 1 level without problem, however when I try to group by a second level I get an error "Uncaught TypeError: Cannot read property 'ProductLine' of null"
My Json Data set that is returned from the server is:
{
"Count":5,
"ViewData":null,
"groups":[
{
"aggregates":null,
"field":"ProductLine",
"hasSubgroups":true,
"items":[
{
"aggregates":{
"JobID":{
"count":2
}
},
"field":"Tier",
"hasSubgroups":false,
"items":[
{
"ProductLine":"CART for Commuters",
"JobID":"042712",
"Tier":"Tier 1"
},
{
"ProductLine":"CART for Commuters",
"JobID":"060712",
"Tier":"Tier 1"
},
{
"ProductLine":"Platinum",
"JobID":"101792",
"Tier":"Tier 1"
}
],
"value":"Tier 1"
}
],
"value":"CART for Commuters"
},
{
"aggregates":null,
"field":"ProductLine",
"hasSubgroups":true,
"items":[
{
"aggregates":{
"JobID":{
"count":1
}
},
"field":"Tier",
"hasSubgroups":false,
"items":[
{
"ProductLine":"CART for Commuters",
"JobID":"042712",
"Tier":"Tier 1"
},
{
"ProductLine":"CART for Commuters",
"JobID":"060712",
"Tier":"Tier 1"
},
{
"ProductLine":"Platinum",
"JobID":"101792",
"Tier":"Tier 1"
}
],
"value":"Tier 1"
}
],
"value":"Platinum"
},
{
"aggregates":null,
"field":"ProductLine",
"hasSubgroups":true,
"items":[
{
"aggregates":{
"JobID":{
"count":2
}
},
"field":"Tier",
"hasSubgroups":false,
"items":[
{
"ProductLine":"Platinum",
"JobID":"101792",
"Tier":"Tier 2"
},
{
"ProductLine":"Platinum",
"JobID":"101792",
"Tier":"Tier 2"
}
],
"value":"Tier 2"
}
],
"value":"Platinum"
}
],
"aggregates":null,
}
My grid code is as follows:
var grid = $("#grid").kendoGrid({
dataSource: {
type: "json",
serverPaging: true,
serverGrouping: true,
serverAggregates: true,
pageSize: 500,
transport: {
read: "http://localhost:6332/api/Test
},
schema: { data: "ViewData", total: "Count", groups: "groups", aggregates: "aggregates" },
group: [{ field: "ProductLine" }, { field: "Tier"}]
},
scrollable: false,
sortable: true,
pageable: true,
columns: colList
});
I have been over it and over it and as far as I can see everything looks correct. I'd appreciate any assistance. Thanks.
My Json Data set that is returned from the server is:
{
"Count":5,
"ViewData":null,
"groups":[
{
"aggregates":null,
"field":"ProductLine",
"hasSubgroups":true,
"items":[
{
"aggregates":{
"JobID":{
"count":2
}
},
"field":"Tier",
"hasSubgroups":false,
"items":[
{
"ProductLine":"CART for Commuters",
"JobID":"042712",
"Tier":"Tier 1"
},
{
"ProductLine":"CART for Commuters",
"JobID":"060712",
"Tier":"Tier 1"
},
{
"ProductLine":"Platinum",
"JobID":"101792",
"Tier":"Tier 1"
}
],
"value":"Tier 1"
}
],
"value":"CART for Commuters"
},
{
"aggregates":null,
"field":"ProductLine",
"hasSubgroups":true,
"items":[
{
"aggregates":{
"JobID":{
"count":1
}
},
"field":"Tier",
"hasSubgroups":false,
"items":[
{
"ProductLine":"CART for Commuters",
"JobID":"042712",
"Tier":"Tier 1"
},
{
"ProductLine":"CART for Commuters",
"JobID":"060712",
"Tier":"Tier 1"
},
{
"ProductLine":"Platinum",
"JobID":"101792",
"Tier":"Tier 1"
}
],
"value":"Tier 1"
}
],
"value":"Platinum"
},
{
"aggregates":null,
"field":"ProductLine",
"hasSubgroups":true,
"items":[
{
"aggregates":{
"JobID":{
"count":2
}
},
"field":"Tier",
"hasSubgroups":false,
"items":[
{
"ProductLine":"Platinum",
"JobID":"101792",
"Tier":"Tier 2"
},
{
"ProductLine":"Platinum",
"JobID":"101792",
"Tier":"Tier 2"
}
],
"value":"Tier 2"
}
],
"value":"Platinum"
}
],
"aggregates":null,
}
My grid code is as follows:
var grid = $("#grid").kendoGrid({
dataSource: {
type: "json",
serverPaging: true,
serverGrouping: true,
serverAggregates: true,
pageSize: 500,
transport: {
read: "http://localhost:6332/api/Test
},
schema: { data: "ViewData", total: "Count", groups: "groups", aggregates: "aggregates" },
group: [{ field: "ProductLine" }, { field: "Tier"}]
},
scrollable: false,
sortable: true,
pageable: true,
columns: colList
});
I have been over it and over it and as far as I can see everything looks correct. I'd appreciate any assistance. Thanks.