jqGrid的 - 保持复选框选择状态 - 刷新页面/重定向/重装 [英] JQGRID - maintain check box selection state - page refresh / redirect / reload
问题描述
^ h 流来维持的复选框选择后,页面刷新/重载/从其他页面重定向的jqGrid
我在 ASPX
页的工作。
我的能够的使用维护分页复选框选择状态下code:
gridComplete:功能(){
。当前是VAR = $(本).getGridParam(页)的toString(); //获取任何previously存储行的这一页,重新选择它们
VAR retrieveSelectedRows = $(本)。数据(当前页);
如果(retrieveSelectedRows){
$。每个(retrieveSelectedRows,功能(指数值){
$('#名单)setSelection(值,FALSE)。
});
}
},
onPaging:功能(一){
变种pagerId = this.p.pager.substr(1); //蒙古包纸ID,如传呼机
变种pageValue = $('input.ui-PG-输入',#pg_+ $ .jgrid.jqID(pagerId))VAL();
VAR saveSelectedRows = $(本).getGridParam('selarrrow'); //存储任何选择的行
$(本)。数据(pageValue.toString(),saveSelectedRows);
}
但是,如何的保持复选框选择状态的的页面刷新/重定向/重装的在的jqGrid
?
另外,我试过的window.onload
以下code,但它不工作
$(#清单),触发(reloadGrid,[{页:1,电流:真正}])。
选择在网格的多个页面的实施是在旧版本的jqGrid的非常棘手。我张贴答案,的回答(尝试的演示)与相应的实现。
在另一侧的多个行的选择在多个页面的情况是很常见的。因此,我在自由的jqGrid实施了新的功能。现在,人们可以只使用新的 multiPageSelection:以
。它改变以下面的方式选择的行为:组合真正
选项多选:真正的
- 可以使用
selarrrow
数组的 pre-选择的创建网格在期间某些行直接。 - 阵列
selarrrow
可容纳行从的其他的页面的ID。该阵列selarrrow
将不被清除上改变页面。 jqGrid的只是选择行如果它的ROWID是阵列中的selarrrow
。 - 单击在复选框列标题全选复选框罢了
selarrrow
与所有的当地的rowid数据
(所有页面)
How to maintain the checkbox selection after the page refresh / reload / redirected from some other page in JQGRID.
I am working in aspx
pages.
I am able to maintain the checkbox selection state in paging using following code:
gridComplete: function () {
var currentPage = $(this).getGridParam('page').toString(); //retrieve any previously stored rows for this page and re-select them
var retrieveSelectedRows = $(this).data(currentPage);
if (retrieveSelectedRows) {
$.each(retrieveSelectedRows, function (index, value) {
$('#list').setSelection(value, false);
});
}
},
onPaging: function (a) {
var pagerId = this.p.pager.substr(1); // ger paper id like "pager"
var pageValue = $('input.ui-pg-input', "#pg_" + $.jgrid.jqID(pagerId)).val();
var saveSelectedRows = $(this).getGridParam('selarrrow'); //Store any selected rows
$(this).data(pageValue.toString(), saveSelectedRows);
}
But, how to maintain the checkbox selection state in page refresh / redirect / reload in JQGrid
?
Also, I tried the following code on Window.OnLoad
, but it is not working
$("#list").trigger("reloadGrid", [{page: 1, current: true}]);
The implementation of selection over multiple pages of the grid is very tricky in old versions of jqGrid. I posted the answer, the answer (try the demo) with the corresponding implementations.
On the other side the scenario of selection of multiple rows over multiple pages is very common. Thus I implemented new feature in free jqGrid. Now one can just use new multiPageSelection: true
option in combination with multiselect: true
. It changes the behavior of selection in the following way:
- one can use
selarrrow
array to pre-select some rows directly during creating the grid. - the array
selarrrow
can hold the ids of rows from other pages. The arrayselarrrow
will be not cleared on changing the page. jqGrid just select rows if it's rowid is in the arrayselarrrow
. - click on "Select All" checkbox in the header of checkbox columns fills
selarrrow
with all rowids of localdata
(from all pages)
The demo demonstrates the new feature.
这篇关于jqGrid的 - 保持复选框选择状态 - 刷新页面/重定向/重装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!