PDA

View Full Version : Removing filtered text programmatically?



suresh22446688
27 Jun 2012, 4:59 AM
Hi,
I am using GXT's filtered grid(http://www.sencha.com/examples-2/#filtergrid). once the filter is applied i need to remove filtered text whatever user has entered.

36585


is it possible to remove "abc" text programatically without user intervention?Please help me.


Thanks!

rherwig
27 Jun 2012, 7:27 AM
Check out the following GridFilters methods:

List<ComponentPlugin> pluginList = grid.getPlugins();
for (ComponentPlugin plugin : pluginList) {
if (plugin instanceof GridFilters) {
((GridFilters) plugin).clearFilters();
((GridFilters) plugin).removeFilter(filter);
((GridFilters) plugin).removeAll();
}
}

suresh22446688
27 Jun 2012, 8:21 AM
@rherwig, Thanks for your reply. i need to remove only the text("abc" in the above screen shot) . but above logic removes entire filter. Please help me.

Thanks!

rherwig
27 Jun 2012, 8:34 AM
You'll have to get the actual Filter for that column using either:
Filter filter = ((GridFilters) plugin).getFilter("dataIndex");
or
List<Filter> filterList = ((GridFilters) plugin).getFilterData();

Once you have the actual filter just call the setValue() method with an empty String:
filter.setValue("");

~r

PS You may have to play with this a bit but I think this is the path... :D

suresh22446688
27 Jun 2012, 9:22 PM
Thanks..it worked