jqGrid多选,移动到下一页时复选框保留
如果您看到 jqGrid 演示:
http://www.trirand.com/blog/jqgrid/jqgrid.html
部分:高级 -->多选
当我移动到下一页时,您会看到选中的复选框不会保留,并且 再次回到上一页..
如何让它持续存在?
这是我的场景,在我的应用程序中有一个组功能,我可以 添加几个客户,我正在使用 jqgrid 来显示数千个客户。
我想检查我想要的每个客户,然后提交该选定的客户并将其添加到指定的组中。
我该怎么做? (使 jqgrid,多选持续存在?)
谢谢。
If you see jqGrid demo :
http://www.trirand.com/blog/jqgrid/jqgrid.html
Section : Advanced --> Multiselect
You'll see that the checked checkbox is not persist when i move to the next page, and
back to the previouse page again ..
How to make it persist ?
It's my scenario, in my applications there is a group functionality where i can
add several customer, i'm using jqgrid to display thousands of customers.
I want to check every customer i want, and then submit this selected customer and add it to the specified group ..
How can i do this ? (make jqgrid, multiselect persist ?)
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
使用 gridComplete 和 onPaging 事件以及 jquery .data() 方法可以非常简单地做到这一点。这比我在网上看到的很多东西要简单得多,所以我想我会分享它。我的网格的选择器是“#employeerolegrid”。
This is fairly simple to do using the gridComplete and onPaging events plus the jquery .data() method. This is much simpler than a lot of the stuff I've seen floating around the net, so I thought I'd share it. The selector for my grid is '#employeerolegrid'.
查看此处的事件列表 http://www.trirand.com/jqgridwiki /doku.php?id=wiki:events
逻辑是:
每次触发“onPaging”事件时,您都应该迭代每一行并将每行的唯一 id 存储到一个数组中,还应迭代您的 id 数组并在每次触发“onPaging”时检查所有选择框。
Look at the event list here http://www.trirand.com/jqgridwiki/doku.php?id=wiki:events
The logic is:
everytime the "onPaging" event is fired, you should iterate through each row and store the unique id of each row to an array, also iterate through your array of id and check all of the select box everytime the "onPaging" is fired.
我的解决方案:(定义变量 current_page 并在事件 loadBeforeSend 中设置)因为
...
函数获取多选值数组
My solution: (define variable current_page and set in Event loadBeforeSend) because
...
Function get multi select Values array
我使用这些函数在
jqGrid
调用中设置了以下三个选项:我的函数如下所示:
下一个:
最后一个:
I set the following three options within the
jqGrid
call with these functions:My functions look like these:
The next one:
And the last one:
没有直接的方法通过jqgrid保留复选框值,而是我们可以创建一个新列来保留复选框值。请参阅以下链接中的演示 http://jsfiddle.net/vasece/cLV4M/
No direct way to retain the check box value through jqgrid, instead we can create a new column to retain the check box value. please see the demo in the below link http://jsfiddle.net/vasece/cLV4M/
我发现这个:
我必须说,它工作得很好。
I found this :
It works pretty fine, I must say.