View Full Version : Grid Filter not filtered

22 Dec 2011, 4:07 AM
Using Grid, Table is formed & the record should display but the condition is that the grid must LOAD ALL the records BUT DISPLAY only those having the data with flag has true i.e., the visualization is limited by the filter with respect to the flag .I have formed the grid but not able to set the filter

3 Jan 2012, 3:44 AM
You can add a filter to the store.

store.addFilter(new StoreFilter<ModelData>() {
public boolean select(Store<ModelData> store, ModelData parent,
ModelData item, String property) {
return item.get(property).equals("visible");

12 Jan 2012, 2:49 AM
I hope so you understand my question

say for example

If the record contains 4 records: 2 Unassigned, 1 Open, 1 Assigned
The grid must display only the 2 records having ‘Open’ and ‘Assigned’ WO status but he User can choose to display all the 4 records selecting also ‘Unassigned’
I am not able to get it Please provide some more example.

12 Jan 2012, 4:18 AM
Hi raj_s37, I understand what you're after. I had the same issue with store filters.
I modified a livesearch plugin to work so that the grid filters out the records but keeps the hidden record in the store. Le tme know if you still need it and I'll post it up for you.

It's been tested in Ext JS 4.0.7, not GWT, but the code should at least show how how to achieve the results your after, even if you need to modify it for GWT.

12 Jan 2012, 4:22 AM
please post the code in GXT which will be helpful

12 Jan 2012, 4:51 AM
Take a look at the ListFilter for the Type column in the following example:

You can set initial value of the filter by:

12 Jan 2012, 6:41 AM

I've attached the modified plugin. I don't have time or enough knowledge to port it to GWT unfortunately, so hopefully this will be able to help you, despite having been written for EXT JS.

The attached code works by using the indexes of flagged rows in combination with the filterBy function.
The complete data for a store is still available after a filter has been applied, but you will want to use the clearFilter() function on the store before applying a new filter, otherwise the new filter will be applied to the filtered data and not the original data. Hopefully this makes sense.

The flow you need is:
grid loads complete store
the default filters you need are applied to the store
the user selects a new filter value (i.e. display all)
clear the existing filter on the store
apply new filter

Just remember to clear any existing filters using clearFilter() before applying a different filter.

Also, take a good look at the filterBy function

Good luck!