PDA

View Full Version : Event after grid data are filtered



TiloS
25 Jan 2012, 5:09 AM
Hello,

is there an event which I can use after data are filtered and/or shown in the grid?

I want to make an own loadMask to use it when the data are filtering. After filtering is ready I want to hide the mask, but I don't find a proper event:

var filterMask = new Ext.LoadMask('gridD', { msg: "Filter..." });

filterMask.show();
store.filter([...]);
(event when filtering is ready ?):

filterMask.hide();
Tilo

jay@moduscreate.com
25 Jan 2012, 11:27 AM
Is your store loaded via ajax or jsonp?

TiloS
25 Jan 2012, 11:49 AM
It's loaded with jsonp.
Is there a difference? I don't want to load it anymore, just filter.

jay@moduscreate.com
25 Jan 2012, 4:03 PM
OK. Are you locally filtering or remotely?

If using remote filters, then the best thing to do is unmask the element after the store's load event fires.

ykey
25 Jan 2012, 4:07 PM
If the filtering is local, I believe you could accomplish this without an event because the filter method will be blocking.



grid.setLoading(true);
store.filter(..);
grid.setLoading(false);

TiloS
26 Jan 2012, 2:36 AM
The filtering is local.

is this:
filterMask.show();
store.filter([...]);
filterMask.hide();
the same as this:
grid.setLoading(true);
store.filter(..);
grid.setLoading(false);?
I tryed it and the mask isn't shown too. I think because the filtering works asynchronous.
But there must be an event internally because with loading the loadmask works automatically.

jay@moduscreate.com
26 Jan 2012, 6:47 AM
I'm no expert with filtering. Can you try to see if the data changed event is fired?

TiloS
30 Jan 2012, 7:12 AM
Yes datachanged is fired (2 times). Filtering needs 2 seconds but still the mask is not shown.
It seems its fired directly on start of filtering or filtering blocks the mask.

ykey
30 Jan 2012, 12:11 PM
Try wrapping filter call in 1ms setTimeout

Something like the following works for me.


grid.setLoading(true);


setTimeout(function() {
store.filter(..);
grid.setLoading(false);
}, 1);

TiloS
23 Feb 2012, 12:07 AM
grid.setLoading(true);

setTimeout(function() {
store.filter(..);
grid.setLoading(false);
}, 1);
It works, thank you.