elishnevsky
19 Jun 2009, 11:11 AM
How to implement server-side paging in a GridPanel using DirectStore? start and limit parameters are not passed to the server with direct request. Am I missing something?
Here's my extension:
Ext.ux.AuthorsGrid = Ext.extend(Ext.grid.GridPanel, {
initComponent: function() {
var ds = new Ext.data.DirectStore({
directFn: Pubs.GetAuthors,
paramsAsHash: false,
root: 'authors',
idProperty: 'au_id',
totalProperty: 'total',
sortInfo: {
field: 'au_id',
direction: 'ASC'
},
fields: [
'au_id', 'au_lname', 'au_fname', 'phone', 'address', 'city', 'state', 'zip',
{name: 'contract', type: 'boolean'}
]
});
var pager = new Ext.PagingToolbar({
store: ds,
displayInfo: true,
pageSize: 10
});
var config = {
store: ds,
columns: [
{header: 'ID', dataIndex: 'au_id'},
{header: 'First Name', dataIndex: 'au_fname'},
{header: 'Last Name', dataIndex: 'au_lname'},
{header: 'Phone', dataIndex: 'phone'},
{header: 'Address', dataIndex: 'address'},
{header: 'City', dataIndex: 'city'},
{header: 'State', dataIndex: 'state'},
{header: 'Zip', dataIndex: 'zip'}
],
bbar: pager
};
Ext.apply(this, Ext.apply(this.initialConfig, config));
Ext.ux.AuthorsGrid.superclass.initComponent.apply(this, arguments);
},
afterRender: function() {
this.getStore().load();
Ext.ux.AuthorsGrid.superclass.afterRender.apply(this, arguments);
}
});
Ext.reg('authorsgrid', Ext.ux.AuthorsGrid);
Here's my extension:
Ext.ux.AuthorsGrid = Ext.extend(Ext.grid.GridPanel, {
initComponent: function() {
var ds = new Ext.data.DirectStore({
directFn: Pubs.GetAuthors,
paramsAsHash: false,
root: 'authors',
idProperty: 'au_id',
totalProperty: 'total',
sortInfo: {
field: 'au_id',
direction: 'ASC'
},
fields: [
'au_id', 'au_lname', 'au_fname', 'phone', 'address', 'city', 'state', 'zip',
{name: 'contract', type: 'boolean'}
]
});
var pager = new Ext.PagingToolbar({
store: ds,
displayInfo: true,
pageSize: 10
});
var config = {
store: ds,
columns: [
{header: 'ID', dataIndex: 'au_id'},
{header: 'First Name', dataIndex: 'au_fname'},
{header: 'Last Name', dataIndex: 'au_lname'},
{header: 'Phone', dataIndex: 'phone'},
{header: 'Address', dataIndex: 'address'},
{header: 'City', dataIndex: 'city'},
{header: 'State', dataIndex: 'state'},
{header: 'Zip', dataIndex: 'zip'}
],
bbar: pager
};
Ext.apply(this, Ext.apply(this.initialConfig, config));
Ext.ux.AuthorsGrid.superclass.initComponent.apply(this, arguments);
},
afterRender: function() {
this.getStore().load();
Ext.ux.AuthorsGrid.superclass.afterRender.apply(this, arguments);
}
});
Ext.reg('authorsgrid', Ext.ux.AuthorsGrid);