Author Topic: totalPages for remote pageModel  (Read 4518 times)


  • Pro Deluxe
  • Newbie
  • *
  • Posts: 17
    • View Profile
totalPages for remote pageModel
« 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

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) {

                if (dataJSON != null)
                    return { curPage: dataJSON.curPage, totalRecords: dataJSON.totalRecords, data: };

 var $gridPatients = $("#grid_patientlist").pqGrid({ width: "auto", height: 700,
            dataModel: dataM,
            pageModel: pageM,
            colModel: colM,
            resizable: false, 
            showTop: false,
            showBottom: true,
            flexHeight: true,
            columnTemplate : { width: '10%' },
            selectionModel: { type: 'none' }  ,
            scrollModel: {autoFit: true}   


  • Administrator
  • Hero Member
  • *****
  • Posts: 6200
    • View Profile
Re: totalPages for remote pageModel
« Reply #1 on: November 05, 2014, 11:02:12 pm »
In this demo 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.

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.
« Last Edit: November 05, 2014, 11:13:17 pm by paramquery »


  • Pro Deluxe
  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: totalPages for remote pageModel
« Reply #2 on: November 06, 2014, 08:27:26 pm »
thanks, it works.

it seems it was some other bug that caused the issue.