在 ExtJS 中过滤

Filtering in ExtJS

我正在用 extjs 筛选商店:

到目前为止一切顺利,我遇到的问题是函数 returns truefalse 实体仍然留在我的商店中。

感谢您的帮助, 丹尼尔

Ext.getStore('xxx').filterBy() 在本地处理从代理检索的数据。所以如果你触发 Ext.getStore('xxx').load()Ext.getStore('xxx').reload () 这将使用从服务器检索的数据擦除本地过滤数据。

你也可以使用Ext.getStore('xxx').load({params:{'param1':'value1'}}) 从服务器端进行过滤。

现在请注意,如果您想再次使用相同的参数,您只需调用 Ext.getStore('xxx').reload() 现在这个等于 Ext.getStore('xxx').load({params:{'param1':'value1'}})。但是如果你使用 Ext.getStore('xxx').load() 就好像你没有向服务器发送任何参数。

最后你应该先用Ext.getStore('xxx').load( {params:{'param1':'value1'}})Ext.getStore('xxx').load()从服务器获取数据,然后使用 filterBy 将本地过滤器应用于检索到的数据。

注意:我假设您使用的是 ajax 或其他代理而不是本地代理