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 p
My solution: (define variable current_page and set in Event loadBeforeSend) because
var page = $(this).getGridParam('page') - 1; not work.
var current_page=0;
...
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) {
$('#employeerolegrid').setSelection(value, false);
});
}
},
onPaging: function () {
var saveSelectedRows = $(this).getGridParam('selarrrow');
//Store any selected rows
$(this).data(current_page, saveSelectedRows);
},
loadBeforeSend:function(){
//set current page
current_page = $(this).getGridParam('page').toString();
}
Function get multi select Values array
function getSelectedValues(){
var saveSelectedRows = $("#YourGrid").getGridParam('selarrrow');
$("#YourGrid").data(current_page, saveSelectedRows);
var retrieveSelectedRows = $("#YourGrid").data();
var arr_values = new Array();
if (retrieveSelectedRows) {
$.each(retrieveSelectedRows, function (index, value) {
$.each(value, function (index, sub_value) {
if(typeof(sub_value)=='string')
arr_values.push(sub_value);
});
});
}
return arr_values;
}