如果启用了分页,jqgrid multiselect 仅选择当前页面上的行。如何让它跨页选择行?
我在 jqgrid 演示(http://www.trirand.com/blog/jqgrid/jqgrid.html > Advanced > Multiselect)中注意到,如果启用分页,则仅选择当前页面上的行(可见)。
有关使其跨多个页面工作的任何提示。或者还有其他替代解决方案吗?
I noticed in the jqgrid demo (http://www.trirand.com/blog/jqgrid/jqgrid.html > Advanced > Multiselect) that only rows (visible) on the current page are selected if paging is enabled.
Any tips on getting it to work across multiple pages. Or any other alternative solutions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我知道这个问题有点尘土飞扬,但我最近需要这个功能,并找到了我认为更干净的方法来实现它。
为什么不使用 jqGrid 的
onSelectRow
和onSelectAll
事件,而不是为每个复选框附加一个事件?当选择一行时,检查所选行的列表是否包含该行(基于 id)。如果它不存在并且已被选择,则将其添加到列表中;如果它存在并且不再被选择,则将其删除。如果选择了所有行,则迭代它们。希望这可以帮助其他人寻找解决方案。
I know this question is kind of dusty, but I recently had a need for this functionality and found what I consider a much more clean way to do it.
Instead of attaching an event to each checkbox, why not use the
onSelectRow
andonSelectAll
events of the jqGrid? When a row is selected, check if our list of selected rows includes this row (based on id). Add it to the list if it was not there and has been selected, remove it if it was there and is no longer selected. If all rows are selected, iterate through them.Hope this helps others looking for a solution.
我假设您想在一个页面中选择一些行,然后转到另一页,也许选择更多行,并保留所有这些选择。
您必须处理每个复选框上的选择事件。将事件处理程序附加到每个 $("#cb_my_grid") 并保留所选项目的数组。然后,当您需要数据时(也许在提交页面时),您可以提交数组中的值。
I'm assuming you would like to do select some rows in one page, then go to another page, maybe select some more rows, and have all of those selection persisted.
You will have to handle the selection events on each check box. Attach an event handler to
each $("#cb_my_grid")
and persist an array of selected items. Then when you need the data (maybe when the page is submitted) you can submit the values in the array.