This is a migrated thread and some comments may be shown as answers.

Issue with Multi Level of Groups

1 Answer 171 Views
Grid
This is a migrated thread and some comments may be shown as answers.
masterK
Top achievements
Rank 1
masterK asked on 19 Oct 2012, 04:05 PM
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.


1 Answer, 1 is accepted

Sort by
0
masterK
Top achievements
Rank 1
answered on 22 Oct 2012, 09:06 AM
I was missing the aggregates at the top group level
Tags
Grid
Asked by
masterK
Top achievements
Rank 1
Answers by
masterK
Top achievements
Rank 1
Share this question
or