I can´t get my grid to work with paging. Here is my code (this code is executed inside the controller.js after the user types some information in a textField control):
var store = Ext.create('App.store.vo.Posts', {
autoLoad: {
params: {
query: textTyped,
start: 0,
limit: 10
},
callback: function (regs) {
me.getGrid().reconfigure(store);
me.getGrid().down('pagingtoolbar').bindStore(store);
}
}
});
and this is my store code:
Ext.define('App.store.vo.Posts', {
extend: 'Ext.data.Store',
model: 'App.model.vo.Post',
autoLoad: true,
autoSync: false
});
The grid populates with data correctly, but the paging is disabled.
UPDATE:
and the Post model:
Ext.define('App.model.vo.Post', {
extend: 'Ext.data.Model',
fields: [
{name: 'id', type: 'auto'},
{name: 'text', type: 'auto'}
],
idProperty: 'id',
proxy: {
type: 'rest',
url : '/posts',
format: 'json',
reader: {
root: 'data',
successProperty: 'success',
totalProperty: 'total'
},
writer: {
// wrap post params for Rails
getRecordData: function(record) {
return { post: record.data };
}
}
}
});