Is there any way to set the Page no for a Jqxgrid dynamically?
I dynamically set the pagesize for a jqxgrid in pageChanged event, so that I can hide the empty rows. But after setting the pagesize, the page no sets to 1. I dont want the page no to be refreshed. This is my code:
$(“#jqxgridcust”).on(‘pagechanged’, function (event) {
var datainfo = $(“#jqxgridcust”).jqxGrid(‘getdatainformation’);
var paginginfo = datainfo.paginginformation;
var PageNumber = paginginfo.pagenum;
var countData = 0;
$.ajax({
type: “POST”,
datatype: ‘json’,
url: ‘@Url.Action(“customerSearchOnPaging”, “Search”)’,
data: { ‘nxPageNumber’: PageNumber },
success: function (data) {
source.localdata = data;
if (data != null && data != “”) {
var arrObj = eval(data);
countData = arrObj.length;
}
$(“#jqxgridcust”).jqxGrid(‘updatebounddata’);
if (countData != 0 && countData < 25)
$(“#jqxgridcust”).jqxGrid({ pagesize: countData });
}
});
})
Grid is initialized as:
virtualmode: true,
pagesize: 25,
pagesizeoptions: [’25’],