I have created a jqgrid as follows:
$("#table_jqgrid").jqGrid({
autowidth: true,
shrinkToFit: true,
datatype: function(postdata) {
jQuery.ajax({
url: 'getxmlInfo',
data:postdata,
dataType:"xml",
complete: function(xmldata,stat){
debugger;
console.log(xmldata);
if(stat=="success") {
var thegrid = jQuery("#table_jqgrid")[0];
console.log(thegrid)
debugger;
thegrid.addXmlData(xmldata.responseXML);
}
}
});
},
colNames: ['col1', 'col2', 'col3', 'col4', 'col5', 'col6'],
colModel :[
{name: 'col1', index: 'col1', width: 60, sorttype: "int"},
{name: 'col2', index: 'col2', width: 90, sorttype: "date"},
{name: 'col3', index: 'col3', width: 100},
{name: 'col4', index: 'col14', width: 80, align: "right", sorttype: "float"},
{name: 'col5', index: 'col5', width: 80, align: "right", sorttype: "float"},
{name: 'col6', index: 'col6', width: 80, align: "right", sorttype: "float"}
],
pager: '#pager_jqgrid',
loadonce:true,
rowNum:10,
rowList:[10,20,30],
sortname: 'col1',
sortorder: 'desc',
rowTotal:40,
viewrecords: true,
});
Everything is working fine when changing records per page.But pagination is not correct. getxmlInfo is a url to servlet function which returns corresponding xml as ajax response.
Initially page number is 1 and records/page is 10 then 10 rows will be shown.Is there any way to set total number of pages in jqgrid?
After a long search one link revealed there exists an option that is setting rowTotal parameter.But it is not working .How we can persist pagination data on each ajax call.Is there exists any solution to set totalrows on each ajax call.