View Full Version : Can you refresh paging toolbar without firing load?

6 Mar 2012, 12:52 AM

I have the following problem:
After inserting a record I need to load the correct page to be able to select the newly created record.
I implemented a load function in my webservice that accepts a recordid, to be able to calculate with the pagesize and orderby info what block of records I have to return.
The response contains the pagenumber.
With the following code I load the records after the insert:

id : id,
scope : this,
callback: function(records, operation, success) {
var loadJson = Ext.decode(operation.response.responseText);
g_modelStore.currentPage = parseInt(loadJson.result.message);

// g_modelGrid.down('sds_pagingtoolbar').doRefresh(); This updates the
pagingtoolbar correctly, but I don't want to fire another server call


Is there a way to update the paging info in the pagingtoolbar without loading the records again?

Thanks for any tips.

6 Mar 2012, 5:20 AM
There's no built-in/convenient way to do this, but it can be done.

View source for the Ext.toolbar.Paging component and look for the getPagingItems function. This is where the child component list is built. Every component on the toolbar has an itemId value which can be used to directly access the desired button, page number input field, etc.

For example, to directly set the page number:


To directly set the 'Displaying n - n of n' message:

myPagingTbar.down('#displayItem').update(Ext.String.format(myPagingTbar.displayMsg, 1, 2, 3));

6 Mar 2012, 12:25 PM
Works perfectly! Thanks a lot!