Anand MR

Anand MR

  • NA
  • 39
  • 19.9k

JQGrid Paging

Apr 22 2015 5:45 AM
Hi Friends,
                In my MVC application i am using  JQgrid .For each record selection we using Check box in this grid.
                In that JQgrid we need to select one or more than one records across all pages.While going to next paging in grid the existing page selected checkbox get refreshed so i am not able to select multiple records from across all pages.


Here is my JQgrid code

function LoadForSearchGridPartial() {

var grid = $('#dgGridSearchListPartail');

grid.jqGrid({
//url: 'SearchResultJson',

datatype: function (pdata) {
getSearchGridData(1);
},
colNames: ['Select', 'ID', 'Name', 'City'],
colModel: [
{
name: 'Select',
index: 'Select',
width: 20,
formatter: "checkbox",
formatoptions: { disabled: false },
// multiselect: true,
checked: "unchecked",
editoptions: { value: 'TruFalse', defaultValue: 'false' },
search: false,
align: "center",




},



{
name: 'CompanyId',
index: 'CompanyId',
width: 55,
search: true,
hidden: true


}, {
name: 'CompanyName',
index: 'CompanyName',
width: 100,
search: true
}, {
name: 'CityName',
index: 'CityName',
width: 100,
search: true
}
],
rowNum: 10,
rowList: [10, 20, 30],
pager: '#pagerGridSearchListPartail',
sortname: 'CompanyName',
viewrecords: true,
sortorder: "asc",
caption: $("#spanTitle").text(),
width: 700,
height: 200,
rownumbers: true,
loadonce: true,
gridComplete: function () {
grid.setGridParam({ datatype: 'local' });
},
onSelectRow: function (MSG_TXT) {

var CompanyId = grid.jqGrid('getCell', CompanyId, 'CompanyId');
var CompanyName = grid.jqGrid('getCell', CompanyName, 'CompanyName');
var CityName = grid.jqGrid('getCell', CityName, 'CityName');

}

});
jQuery("#dgGridSearchListPartail").jqGrid('filterToolbar', { stringResult: true, searchOnEnter: false, defaultSearch: "cn" });
$("#dgGridSearchListPartail").jqGrid('resetSelection');


grid.jqGrid('navButtonAdd', '#pagerGridSearchListPartail',
{
caption: "Select", onClickButton: function () {
var id = grid.jqGrid('getGridParam', 'selrow');
var CompanyId = grid.jqGrid('getCell', id, 'CompanyId');
var CompanyName = grid.jqGrid('getCell', id, 'CompanyName');
var CityName = grid.jqGrid('getCell', id, 'CityName');
// alert(CFAId);
if (CompanyName) {

} else { alert("Please select Row") }
}
});

}





Can anyone please guide for this

Thanks

Answers (1)