Paging toolbar list all rows from store in Extjs2
I am using PaggingToolbar to support paging at a gridPanel. Problem is, every page displays all the records from the store. Can anyone help to solve the issue. Code details as follows:
I have a store with xmlReader
var store = new Ext.data.Store( {
url :'urltoreturnxml',
reader :new Ext.data.XmlReader( {
record :'Book',
id :'@id',
totalRecords :'@total'
}, [{
name :'book_id',
mapping :'@id'
}, {
name :'price',
mapping :'@price'
} ])
});
And a grid panel
var grid = new Ext.grid.GridPanel( {
store :store,
viewConfig : {
forceFit :true
},
loadMask: true,
width : 685,
height : 200,
columns : [
// column names
],
bbar: new Ext.PagingToolbar({ // paging bar on the bottom
store: store,
displayInfo: true,
displayMsg: 'Displaying topics {0} - {1} of {2}',
emptyMsg: 'error'
}),
开发者_开发问答sm :new Ext.grid.RowSelectionModel( {
singleSelect :true
}),
listeners : {
//some code
}
});
I load store as follows
store.load({ params: {
start: 0,
limit: 20
},
callback : function(r, options, success) {
// callback function
}
});
Any help is appreciated. Thanks.
Your server needs to return the amount of records it is asked to serve. If you return all the records regardless of your client request you will get all the results in the gird.
精彩评论