简体   繁体   English

Ext.js网格过滤器未触发

[英]Ext.js grid filter not triggering

I'm new to Ext.js but for a customer I'm looking into their grid code in an effort to get their column filtering working properly. 我是Ext.js的新手,但对于一个客户,我正在研究他们的网格代码,以使他们的列过滤正常工作。 The grids by default are using the string filter on most columns. 默认情况下,网格在大多数列上都使用字符串过滤器。 I was able to update a column for testing to use a list filter. 我能够更新一列进行测试以使用列表过滤器。 On the front end, this appears initially to work as both the string filter and list filter display as expected. 在前端,它最初看起来像预期的那样同时充当字符串过滤器和列表过滤器。 The issue is that once the filter is selected (or text entered in the string box filter), nothing happens. 问题在于,一旦选择了过滤器(或在字符串框过滤器中输入了文本),就什么也不会发生。 No filter is triggered, no messages on the console. 没有触发过滤器,控制台上没有消息。 Nothing. 没有。 I'm not sure where to start to troubleshoot this. 我不确定从哪里开始进行故障排除。 Seems like it must be a global issue with the code that is creating the grid (which is centralized). 似乎这与正在创建网格(集中化)的代码有关,是一个全球性问题。 The following components are located in their Ext.require statement: 以下组件位于其Ext.require语句中:

Ext.require([
'Ext.data.*', 
'Ext.grid.*',
'Ext.grid.plugin.BufferedRenderer',
'Ext.ux.grid.FiltersFeature',
'Ext.ux.form.SearchField',
'Ext.toolbar.Paging']);

Without including the entire code (which is spread out into multiple libraries) any suggestions on where to focus my troubleshooting efforts? 在不包括整个代码(这些代码分布在多个库中)的情况下,关于将故障排除工作集中在哪里的任何建议?

VERSION 4.2.2 of Sencha Ext.js Sencha Ext.js的版本4.2.2

In grid you have to add this config 在网格中,您必须添加此配置

 features: [{
    ftype: 'filters',
    local: true
}]

You can also see running examples and code in this link. 您还可以在此链接中查看运行示例和代码。

http://docs.sencha.com/extjs/4.2.5/extjs-build/examples/build/KitchenSink/ext-theme-neptune/#big-data-grid http://docs.sencha.com/extjs/4.2.5/extjs-build/examples/build/KitchenSink/ext-theme-neptune/#big-data-grid

Found the problem. 找到了问题。 The issue was that in the grid store definition there was a call to a filterBy method which was returning true in all cases. 问题是在网格存储定义中有一个filterBy方法的调用,该方法在所有情况下都返回true。 I suspect this was overriding any filtering results I was attempting with the string filter.Removing the call to that method had the desired result. 我怀疑这会覆盖我尝试使用字符串过滤器的所有过滤结果。删除对该方法的调用具有所需的结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM