PDA

View Full Version : Clearing store with PagingToolbar



steffenk
3 Mar 2010, 3:57 PM
Hi,

if i clear the store with
store.removeAll()

the grid is empty and the records are removed - but the PagingToolbar doesn't refresh and shows all records (count and pages), even if i click on the refresh button, all records are visible again.

How can i reset the PagingToolbar as well?

tobiu
4 Mar 2010, 1:27 AM
Hi Steffen,

the PagingToolbar itself has no reset-method.
I guess you are using no local store, so you should reload the store sending the param start:0 and return totalCount:0 in your JSON / xml.

As a workaround, you could also try to call the priate method:



store.removeAll();
store.setBaseParams({start:0});
myPagingToolbar.onLoad(store, 0, {});


Kind regards,
tobiu

steffenk
4 Mar 2010, 2:49 AM
Hi Tobi,

sure, i could make a request with empty result. But i don't like it, as i only want to clear the data. So i don't get why the binded control doesn't update correct.
For now i disable the pageingToolbar, but then it shows the loading indicator. Hiding component adds strange white bar (i think an CSS issue).

I also try to unbind, but this cause error (this.store is undefined). I will dig into the code later, do you confirm this as Bug?

tobiu
4 Mar 2010, 6:03 AM
Hi Steffen,

did my workaround work?
I took the time to search the forums and Condor has already written a patch that perfectly fits your needs (listening to add, remove, remove all).

https://www.extjs.com/forum/showthread.php?p=395032#post395032


Kind regards,
Tobias

steffenk
4 Mar 2010, 9:22 AM
Hi Tobi,

your hack doesn't work for me, PagingToolbar doesn't change anything, also refresh shows all records again.

I will test Condor's override, i only need the clear-part, i don't add any rows programmatically.

Thanks for your help!

steffenk
4 Mar 2010, 9:38 AM
Hi,

The override from Condor just works perfect!

The reason why i do this:

I have a store with remote bound, a grid showing the data. I use this as "search in data", so i only load data if a search is done. Like with all search i have a "clear" button which empties the view and clear the search field, so i need the controls updated.

I don't agree with evant that this is no bug - in my eyes every store-bound object should change when store data change, if i do that manually i don't need any bound. But this is another story:)