Extjs 4.1.3 Button That Sets Active Filters
I want to add a button to the toolbar that automatically sets a filter as active and then subsequently filters the data. I have tried using the setActive() function for Ext 4.1.3 b
Solution 1:
The setActive method can't be found in the location you look for it. You're trying to execute setActive on a list of filters, but the actual function can only be executed once you have found the specific filter object.
In your example code (the Fiddle is of no use as you skipped the column in question there) you would get the filter first like this:
var filter = grid[uniqueId].filters.getFilter('TopicStateValue');
filter.setActive(true);
However activating the filter doesn't do what you expect it to do. It will merely enable the filter UI element in the filters bar. To execute said filter automatically after enabling it you need to set the Value for that filter:
filter.setValue('Open/Current');
If you're not using the filters bar or don't want to show this particular filter dropdown to the user at all, you're better off filtering the store directly:
var store = grid[uniqueId].getStore();
store.filterBy(function(item) {
return item.TopicStateValue == 'Open/Current';
});
Post a Comment for "Extjs 4.1.3 Button That Sets Active Filters"