这个问题( EXTjs gridfilter: How to clearfilter without reloading store? )展示了如何清除整个网格上的所有过滤器。
有没有办法只清除特定列中的过滤器?例如,如果我有一列包含 20 个选项的列表过滤器,并且我选择了其中 8 个,我需要一个按钮来取消选中所有这些选项,但保留我选择的任何其他过滤器保持不变。
此演示中的“大小”列是过滤的一个很好的示例:http://dev.sencha.com/deploy/ext-4.0.0/examples/grid-filtering/grid-filter-local.html
最佳答案
您可以使用setActive
来做到这一点过滤器的方法。
以下是获取此过滤器的引用的方法:
// FiltersFeature adds a filters property to the grid it is bound to
grid.filters.getFilter('size').setActive(false)
编辑:如何取消选中所有框
var filter = grid.filters.getFilter('size');
filter.menu.items.each(function(checkbox) {
// The second argument suppress the check event in order to prevent
// unexpected behaviour, like the filter reenabling itself and trying
// to update the store several times in a row
checkbox.setChecked(false, true);
});
关于Extjs 网格面板过滤器 - 仅清除一列中的过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17710636/