PDA

View Full Version : [CLOSED] GridPanel with local filtering



Kev
Dec 09, 2013, 3:52 PM
Hello,
after applying a local gridfilter to a gridpanel column, what is the best way of accessing the records that are left as a result of the filter? I'd like to access them client side if possible?
Thank you,
Kevin

geoffrey.mcgill
Dec 09, 2013, 6:49 PM
Hello,
after applying a local gridfilter to a gridpanel column, what is the best way of accessing the records that are left as a result of the filter? I'd like to access them client side if possible?
Thank you,
Kevin

The Store .data will be updated with only the filtered records. The following sample demonstrates looping through each of the records in the Store.

Example


App.Store1.each(function (record) {
console.log(record);
});

Or, you can access the Record collection directly.


App.Store1.data.items

The client-side Store docs can help with more api calls for accessing Records.

http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.data.Store

Hope this helps.

Kev
Dec 10, 2013, 10:22 AM
The Store .data will be updated with only the filtered records. The following sample demonstrates looping through each of the records in the Store.

Example


App.Store1.each(function (record) {
console.log(record);
});

Or, you can access the Record collection directly.


App.Store1.data.items

The client-side Store docs can help with more api calls for accessing Records.

http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.data.Store

Hope this helps.

I have followed this example where the filter is applied on the server via a direct event:

http://examples2.ext.net/#/GridPanel/Plugins/GridFilters_Local/

The FilterUpdate listener on the gridfilter is called before the store is actually filtered though. So the store doesn't contain the filtered records. Is there any workaround for this?

Daniil
Dec 10, 2013, 12:23 PM
Hi,

Yes, I think the FilterUpdate fires when a UI filter elements is update (for example, a user types something in a TextField).

To catch filtering of Store, please try to use its FilterChange event.
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.data.Store-event-filterchange