View Full Version : paging not correctly

4 Feb 2012, 10:18 PM
My paging doesnt seem to be working correctly. I am trying to display 3 result perpage.. but it showing all in one page and when you click next page it repeating the same results 2nd page and so forth. How can i fix this?


extend: 'Ext.data.Model',
fields: [
// set up the fields mapping into the xml doc
// The first needs mapping, the others are very basic
{name: 'Author', mapping: 'ItemAttributes > Author'},
'Title', 'Manufacturer', 'ProductGroup'

// create the Data Store
var store = Ext.create('Ext.data.Store', {
pageSize: 3,
model: 'Book',
autoLoad: true,
proxy: {
// load using HTTP
type: 'ajax',
url: 'sheldon-2.xml',
// the return will be XML, so lets set up a reader
reader: {
type: 'xml',
// records will have an "Item" tag
record: 'Item',
idProperty: 'ASIN',
totalRecords: '@total'

// create the grid
var grid = Ext.create('Ext.grid.Panel', {
store: store,
columns: [
{text: "Author", flex: 1, dataIndex: 'Author', sortable: true},
{text: "Title", width: 180, dataIndex: 'Title', sortable: true},
{text: "Manufacturer", width: 115, dataIndex: 'Manufacturer', sortable: true},
{text: "Product Group", width: 100, dataIndex: 'ProductGroup', sortable: true}
width: 540,
height: 200,
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: store,
displayInfo: true,
displayMsg: 'Displaying topics {0} - {1} of {2}',
emptyMsg: "No topics to display"


5 Feb 2012, 1:22 AM
Paging has to be implemented on the backend too. It seems that you are reading from an XML file. When the store sends a request (when paging is being used), the start and limit parameters are sent in that request and the backend has to be able to send back just those records to the store. In case of this file, its always the same data being sent to the store.

5 Feb 2012, 6:46 AM
Thanks..If i am using server side xml feed , where will the start and limit be added or is it added automatically how do i go about settign it up correctly?


5 Feb 2012, 7:03 AM
I dont know exactly how you can do it with XML but here is what you need to consider: when the store sends a paging request, you will see that in the URL, there is a start and limit parameter. These values are based on the page you are trying to access and the page size. On the server side, you have to be able to read these parameters, read your data from XML file etc. and send the requested range of data to the store.