PDA

View Full Version : How to re-send the param values when user clicks the refersh button on a pagingToolba



nikhilkrishnan
28 Jun 2010, 11:50 PM
Hi,
I have a grid which loads the store based on values selected from a combobox. I want to send the same values again if the user clicks the refersh button on the pagingToolbar.

How can i do that

Thanks
Nikhil

Animal
28 Jun 2010, 11:53 PM
It should already do that. Have you checked in Firebug?

Condor
29 Jun 2010, 12:04 AM
No it doesn't. I don't know why, but PagingToolbar is using store.load() instead of store.reload(), so all parameters from the original request that are not stored in the store.baseParams are lost on paging/refresh.

Animal
29 Jun 2010, 1:07 AM
Yikes! I just assumed it would call reload()! That's an Ext bug surely.

nikhilkrishnan
29 Jun 2010, 1:08 AM
It should already do that. Have you checked in Firebug?
Yes i did, its only sending the start and limit values to the server.

Animal
29 Jun 2010, 1:14 AM
Try this nasty temp bodge:



Ext.override(Ext.PagingToolbar, {
doLoad : function(start){
if (start == this.cursor) {
this.store.reload();
} else {
var o = {}, pn = this.getParams();
o[pn.start] = start;
o[pn.limit] = this.pageSize;
if(this.fireEvent('beforechange', this, o) !== false){
this.store.load({params:o});
}
}
}
});

Condor
29 Jun 2010, 1:20 AM
That would fix the refresh, but it would still drop all parameters when paging.

Animal
29 Jun 2010, 1:44 AM
It would use the previously used parameters wouldn't it? Only if the page being requested was the same as the current page.

Condor
29 Jun 2010, 2:27 AM
requested page == current page === refresh
requested page != current page === paging

For a refresh it is now doing a reload(), but for paging it is still doing a load().

But even a reload({params:{...}}) wouldn't use the previous parameters.

nikhilkrishnan
29 Jun 2010, 2:32 AM
Hi Animal,

I think its working now with your code. Now store sends selected param value to server when pressing the refresh button

Thanks

Condor
29 Jun 2010, 2:33 AM
You should really move those parameters to the store baseParams, because they will also not be sent for the second page.

Animal
29 Jun 2010, 2:39 AM
Well, if the params must be on every call, then that is a case for baseParams.

nikhilkrishnan
29 Jun 2010, 3:04 AM
hi Condor,

I haven't throughly checked the code.But it seems to be working for now. I have just checked with one page

Nikhil

nikhilkrishnan
28 Jul 2010, 4:14 AM
Well I'm stuck with this issue again. I have tried animals code and it does work with the refresh button and then i tried the paging button and nothing happens.

I have checked with firebug and seems that no request is passed when paging button is clicked

Condor
28 Jul 2010, 4:22 AM
Don't use Animal's override (it's not complete, so it shouldn't be used as it is).

Store your extra parameters in baseParams and do a load with start & limit parameters.

nikhilkrishnan
28 Jul 2010, 4:37 AM
Hoooo its working thank you very much....