Extjs 网格面板过滤器 - 仅清除一列中的过滤器

标签 extjs extjs4.2

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

相关文章:

extjs - 在extjs中动态更新记录中的字段

javascript - 我怎样才能告诉 sencha cmd 停止混淆我的文件?

extjs - Ext.isIE 在 IE 11 中返回 false

extjs - 未处理的PromiseRejection警告: Error: Cannot find module using ext-gen

javascript - 激活选项卡面板中的选项卡而不访问它 extjs4.2

java - JSON 作为表单参数

javascript - 如何让 ExtJs RowExpander 仅在某些行上显示图标 ([+])?

extjs - 如何在 Extjs View 中引用两个同名商店之一?

javascript - 调整元素大小,使其与不滚动所需的高度完全一样

javascript - 加载商店时如何触发 extjs 3.4 组合的 onSelect?