从 ExtJS 中的存储中删除过滤器
我使用 store.filter(string, string)
方法显式向 Ext.data.Store
添加过滤器。
但是,我不知道如何从商店中删除过滤器。因此,即使在使用 store.load() 重新加载后,过滤器也始终适用。我看到的唯一解决方法是重新启动整个网络应用程序。
如何从 Ext.data.Store
中删除过滤器?
I explicitly add a filter to a Ext.data.Store
using the store.filter(string, string)
method.
However, I can not figure out how to remove filters from the store. So the filters always apply even after reloading using store.load()
. The only workaround I see is to restart the entire web app.
How do I remove a filter from an Ext.data.Store
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
除了 Mchi 的回答之外,我想说的是,可以删除特定的过滤器(clearFilter() 将它们全部删除)。
为此,不要使用
store.filter('property_to_filter','value')
方法,而是使用:删除过滤器 使用:
Update (for > 4.2.0)
在 4.2.0 方法中添加/删除特定过滤器已添加:
有关更多信息,请查看文档:Ext.data.Store.addFilter, Ext.data.Store。删除过滤器
In addition to Mchi's answer, I want to say that it is possible to remove specific filter (clearFilter() removes them all).
To do that, instead of using
store.filter('property_to_filter','value')
method, use:to remove filter use:
Update (for > 4.2.0)
In 4.2.0 methods for adding/removing specific filter were added:
For more info check out docs: Ext.data.Store.addFilter, Ext.data.Store.removeFilter
您需要
clearFilter()< /代码>
You need to
clearFilter()
编辑:我刚刚发现(浏览 API 以了解其他内容)它甚至更容易。有一个参数(布尔值),如果为 true,则在使用 RemoteFilter 时不会重新加载数据...
所以这里是:
来源:存储 API >清除过滤器
我不敢相信我为此挣扎了这么久。在我查看的每个论坛中,我都看到clearFilter,它对于远程过滤没有用,我所要做的就是添加“true”...
原始帖子:
IMO,这绝对不能令人满意。
当使用服务器后端获取数据时(很多人都会这样做),使用
remoteSort
和remoteFilter
+分页来管理大型结果集,它甚至毫无用处。调用
clearFilter()
实际上会在重新应用过滤器之前重新加载数据。因此每次应用过滤器时都会发送 2 个 ajax 请求。这件事困扰了妈妈很久。实际上你所要做的就是:
Edit: I just found out (browsing the API for something else) that it's even easier. There's a parameter (boolean) which, if true, doesn't reload the data when using remoteFilter...
So here goes :
Source: Store API > clearFilter
I can't believe I struggled for so long with that. In every forum I looked, I saw clearFilter which wasn't useful for remote filtering, and all I had to do was to add "true"...
Original Post:
IMO, this is absolutely not satisfying.
When using a server backend to get the data (as many would), with
remoteSort
andremoteFilter
+ paging to manage large result sets, it's even useless.Calling
clearFilter()
actually reloads the data before reapplying the filter. So 2 ajax requests are sent each time a filter is applied. This has bothered ma for a long time.All you have to do is actually :