ExtJS 分页网格仅过滤第一页
我正在研究一个使用过滤器的网格,但它只过滤第一页。当我单击“下一步”时,它会忘记我的过滤器并加载下一组记录。即使我单击“下一步”从分页加载下一组记录,如何让它记住过滤器?
I am working on a grid which uses filters, but it only filters the first page. When I click 'next' it forgets about my filters and loads the next set of records. How do I make it remember the filter even if I click 'next' to load the next set of records from paging?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要将过滤器参数设置到商店的
baseParams
中。在商店的load
调用中传递过滤器参数只会将它们用于第一次加载调用 - 分页工具栏进行的后续调用将不会传递它们。ExtJS
Ext.data.Store
文档有详细信息。You need to set the filter parameters into the store's
baseParams
. Passing your filter parameters in theload
call on the store will only use them for the first load call — subsequent calls made by the paging toolbar won't pass them.The ExtJS
Ext.data.Store
docs have the details.像上面的答案一样,设置
baseParams
仅适用于 EXTJS 3.x 或更低版本。对于 EXTJS 4.xx,我们必须在商店的代理中添加带有您的查询的
extraParam
:store.getProxy().extraParam= JSON 编码查询
喜欢:
store.getProxy().extraParam= Ext.JSON.encode({'sort':[{'id':'ASC'}]})
为了进行正确的配置,请在导航器开发人员工具或后端中调查您的请求
Setting the
baseParams
, like in the answer above, is only for EXTJS 3.x or less.For EXTJS 4.xx, we must add in the store's proxy, an
extraParam
with your query:store.getProxy().extraParam= A JSON ENCODED QUERY
like:
store.getProxy().extraParam= Ext.JSON.encode({'sort':[{'id':'ASC'}]})
For a proper configuration, investigate the your request, in your navigator developer's tools or in your backend