1

这个问题(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

4

1 回答 1

3

您可以使用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);
});
于 2013-07-17T21:40:44.670 回答