jeudi 15 mai 2014

Grid doesn't understand totalProperty

Hello there! How are you guys?

I'm using EXT 4.2 and it's MVC architecture.

I have a View with a grid which is populated by a Store using a JSON proxy. This grid does have a "pagingToolbar" docked at it's top. I have "pageSize" defined to "25" on my grid, and "limit" and "pageSize" also defined to "25" on my Store. Somehow, the grid don't recognize the "totalProperty" value from my reader. I can confirm that JSON's values are correct through Firebug, but my grid's "displayMsg" keep displaying "1 - 25 from 25", when my JSON returns "1880" as it's "total" value. As a result of this problem, I'm not able to navigate through pages...


Do you guys have any ideia on what's going on? I'll post some codes below.


Store:



Code:



Ext.define('MyApp.store.Empresas', {
extend: 'Ext.data.Store',

model: 'MyApp.model.Empresas',
start: 0,
limit: 25,
pageSize: 25,

autoLoad: true,

proxy: {
type: 'ajax',
api: {
read: 'resources/data/empresas/ajx_lista_empresas.php',
update: 'resources/data/empresas/ajx_update_empresas.php',
create: 'resources/data/empresas/ajx_create_empresas.php',
destroy: 'resources/data/empresas/ajx_destroy_empresas.php'
},
reader: {
type: 'json',
root: 'data',
successProperty: 'success',
totalProperty: 'total'

},
//writer: {
// type: 'json',
// root: 'data',
// encode: true
//}
}
});

pagingToolbar definition:


Code:



{
dock: 'top',
xtype: 'pagingtoolbar',
store: 'Empresas',
pageSize: 25,
displayInfo: true,
displayMsg: 'Registros {0} - {1} de {2}',
emptyMsg: 'Sem Registros'
}

Firebug's JSON ;

firebug.jpg

(I had to hide somethings because this is real data, but you can see the "total" value).


Aucun commentaire:

Enregistrer un commentaire