PDA

View Full Version : Go to the required Page EXTJS Paging tool bar



kannanRangasamy
5 Dec 2011, 1:38 AM
Hi,
Is there any way to get to the required page on load itself?

Eg: I have 10 pages using my paging tool bar, how can i go to the 5th page directly on loading the grid.
Also how to get the records of the 5th page?

any ideas?

tobiu
5 Dec 2011, 1:47 AM
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.toolbar.Paging



store.load({
params: {
// specify params for the first page load if using paging
start: 0,
limit: myPageSize,
// other params
foo: 'bar'
}
});

kannanRangasamy
5 Dec 2011, 1:56 AM
Hi,
I gave the start parameter as 5 to load the fifth page,but still its not loading fifth page.Please let me know if there is any other way..

skirtle
5 Dec 2011, 2:35 AM
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.data.Store-method-loadPage


store.loadPage(5);

However, it should be noted that it is the server's responsibility to return the correct page. The server will be sent 3 request parameters:


page - the page number. Starts at 1.
limit - the page size.
start - the index of the first result on the page. Starts at 0. Note that setting this to 5 does not mean the 5th page as you implied in your question. Setting it to 5 means you want the results to start at the 6th result.


There is redundancy here. It isn't necessary for the server to process all 3 parameters, you should pick whichever combination works for you. If the server returns more results than were requested they will all end up in the store. The store will not do internal paging, it will trust the server to return the correct results.