extjspaginationgrid

paging in grid extjs


i want to use the paging toolbar but have one problem. I don't make the service so i need to work with the json i have. The problem is that the format of the json is different then the tutorials.

{
"Weather": [{
    "totalCount": 2962,
    some data
           },{
    "totalCount": 2962,
    some data
           }]
}

but in the tutorials i saw it should be

{
"totalCount": 2962,
"Weather": [{
    some data
           },{
    some data
           }]
}

Is there a way i could use the format i have? I tried to do this:

proxy: {
      type: 'ajax',
  url: detailURL,
       reader: {
            type: 'json',
            root: 'Weather',
            totalProperty: 'Weather.totalCount'
     }
   },

that didn't worked. Suggestions?


Solution

  • Your format is wrong, since the total count is inside of each array element. Unfurtunatelly you will need to change your format. You can try something like:

    // inside your reader (gets the totalCount of the first array element)
    totalProperty: 'Weather[0].totalCount'
    

    But it really isn't the right choice, since it does not make sense to have each array element with the same count, don't you agree?