View Full Version : Question regarding refresh button of PagingToolbar

18 Jun 2009, 8:04 AM
Hi all,

I have a GridPanel and apply a paging toolbar to it. Here is a snippet of my PagingToolbar:

this.Toolbar = function(pageSize){
this.tb = new Ext.PagingToolbar({
pageSize: pageSize,
store: this.store,
displayInfo: true,
displayMsg: 'Displaying results {0} - {1} of {2}',
emptyMsg: "No results to display"

If I enter the number of page I want to load and then press 'enter' key, grid indeed loads the
specified page.

However, if I enter the number of page and then click on 'Refresh' button, the same page
is loaded instead of the specified.

Is it due to the way, Refresh button works by default? Does anyone know how to fix it ?

Thanks in advance

18 Jun 2009, 8:33 AM
it *should* load the page that was last loaded.

18 Jun 2009, 8:35 AM
It works perfectly in the example: http://extjs.com/deploy/ext-3.0-rc2/examples/grid/paging.html

18 Jun 2009, 7:47 PM
Is it due to the way, Refresh button works by default? Does anyone know how to fix it ?

Thanks in advance

Yes, I suspect that is the intended way it works by default. You could either override the PagingToolbar, or you could listen to an event, perhaps beforeload and adjust the pagesize manually.

18 Jun 2009, 11:41 PM
Thank you guys for your responses!
One more question please since I am novice user of ExtJS. Are you aware of a relative thread
or code example where PagingToolbar is overriden? It is not clear to me how to proceed.

Thank you.

19 Jun 2009, 5:30 AM
There are several articles in the wiki, and one in my signature discussing overriding. I'm not sure if you know about overriding already, or you're just asking specific to PagingToolbar. I do not know of any article/post specific to PagingToolbar.

From a usability standpoint I think the current behavior is the correct one. If you have a 30 page grid and some user is on page 12 and then types in 22 but then decides they just want to refresh the current page then your override would complicate that for the user.

This is completely untested, if it doesn't work it might at least give you some ideas where to look:

onRefreshClick: function(){
this.cursor = Math.max(0, (this.inputItem.getValue()-1)*this.pageSize);

19 Jun 2009, 5:32 AM
Note, how you implement also depends if you only want the refresh button to recognize that field or if you want the prev/next buttons to also recognize it.