Looks like we can't reproduce the issue or there's a problem in the test case provided.
-
Sencha User
ExtJS4: JsonReader: Ignoring the value set for totalProperty
I am migrating from jqGrid to ExtJS4, and would like to keep the server side code same for both. I have downloaded 4.0.7gpl version.
While returning JSON data for a Grid, the server sends the following parameters:
Code:
{ total: 7, page: 1, records: 350, rows: [......] }
In the Ext Store configuration, I have set pageSize to 50 and the Store and JsonReader is configured as follows:
Code:
that.store = Ext.create('Ext.data.Store', {
pageSize: 50,
model: that.model,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/db.php',
limitParam: 'rows',
pageParam: 'page',
reader: {
type: 'json',
root: "rows",
totalPropery: "records"
}
},
As you notice, the totalProperty has been set to "records". But ExtJS4 always reads the "total" parameter returned, inspite of specifying to read "records" parameter. As I see in the documation, the default value for totalProperty is "total".
If I make the server not send the "total" parameter, ExtJS4 correctly reads the "records" parameter to find the total number of records in the dataset.
The Fix required:
Since the totalProperty has been set to "records", the store should read that parameter only and not look for "total" property, which may be sent by the server.
-
Sencha User
Sorry! Please ignore this question.
Just noticed that there was a typo for totalProperty, (instead I had specified totalPropery).