ParamQuery grid support forum
General Category => ParamQuery Pro Evaluation Support => Topic started by: lucafik on November 05, 2014, 05:07:44 pm
-
I have a problem with setting totalPages. In free version, totalPages was set automatically, but now its not.
I already have a helper .NET method that worked for free version, and I use it with getUrl, so since I switched to PRO I dont want to change it, I want to keep using the same method (without parameters, gets them from querystring).
I have read this example
http://paramquery.com/pro/demos/paging
I dont understand how is totalPages set. I read that for remote you need to set it manually, but in this example it is not set.
Here is relevant part of my code
var pageM = {
type: 'remote',
curPage: 1,
totalPages: 3,
rPP: 30,
rPPOptions: [5, 30, 50]
}
var dataM = {
location: "remote",
sorting: "remote",
dataType: "JSON",
method: "POST",
sortIndx: 0,
sortDir: "up",
getUrl: function () {
},
getData: function (dataJSON, textStatus, jqXHR) {
$("#patients_loader").hide();
$(".container_patientlist").show();
if (dataJSON != null)
{
return { curPage: dataJSON.curPage, totalRecords: dataJSON.totalRecords, data: dataJSON.data };
}
}
}
var $gridPatients = $("#grid_patientlist").pqGrid({ width: "auto", height: 700,
dataModel: dataM,
pageModel: pageM,
colModel: colM,
resizable: false,
showTop: false,
showBottom: true,
flexHeight: true,
editable:false,
columnTemplate : { width: '10%' },
selectionModel: { type: 'none' } ,
scrollModel: {autoFit: true}
});
-
In this demo http://paramquery.com/pro/demos/paging grid sends the paging parameters i.e., pq_curPage and pq_rPP on its own which are received by the remote .NET method.
public ActionResult paging(int pq_curPage, int pq_rPP)
Either url or getUrl is required for remote requests.
http://paramquery.com/pro/api#option-dataModel-url
Moreover you don't need to set or modify pageModel.totalPages as totalPages are calculated automatically by the grid based on totalRecords. You only need to return totalRecords, curPage and data from the remote method as shown in the remote paging example.
-
thanks, it works.
it seems it was some other bug that caused the issue.