ParamQuery grid support forum

General Category => ParamQuery Pro Evaluation Support => Topic started by: stevejacobsen on May 26, 2016, 05:12:38 am

Title: Not getting pq_rpp and pq_curpage not being passed in POST
Post by: stevejacobsen on May 26, 2016, 05:12:38 am
I'm having trouble getting the pq_rpp and pq_curpage parameters passed in the post. When I use this.rPP and this.curPage it doesn't pass any values. If I hard code them to pq_rpp: 20, and pq_curpage: 1 I get the first page of data but then it of course doesn't allow me to advance to new pages of data.

Quote

$(function () {

//define colModel
    var colM = [
        {title: "Part", width: 120, dataIndx: "Part", align: "left", cls: 'result'},
        {title: "Description", width: 225, dataIndx: "Description", align: "left"},
        {title: "Price", width: 75, dataIndx: "Price", align: "right", dataType: "float"},
        {title: "Orig Price", width: 75, dataIndx: "Origprice", align: "right", dataType: "float"},
        {title: "Net Price", width: 75, dataIndx: "Net", align: "right", dataType: "float"},
        {title: "Supplier", width: 75, dataIndx: "Supplier", align: "center", dataType: "integer"},
        {title: "Updated", width: 100, dataIndx: "Updated", align: "right"}
    ];

    var dataModel = {
        location: "remote",
        dataType: "JSON",
        method: "POST",
        curPage: 1,
        getUrl: function (ui) {
            return {
                url: "utilities/ajax_get_catalog_data_JSON.php",
                data: {
                    pq_rpp: this.rPP,
                    pq_curpage: this.curPage
                }
            };
        },
        getData: function (dataJSON) {
            return {curPage: dataJSON.curPage, totalRecords: dataJSON.totalRecords, data: dataJSON.data};
        }
    };

    var obj = $("div#catalog_grid").pqGrid({
        width: 900,
        height: 400,
        dataModel: dataModel,
        colModel: colM,
        pageModel: {type: "remote", rPP: 20, strRpp: "{0}"},
        collapsible: false,
        wrap: false, hwrap: false,
        title: "Catalog",
        resizable: true
    });


    var grid = $("#catalog_grid").pqGrid(obj);
Title: Re: Not getting pq_rpp and pq_curpage not being passed in POST
Post by: stevejacobsen on May 26, 2016, 05:39:43 am
I just noticed that I left  paging: "remote", out of the dataModel. I have added that and it hasn't changed the results.
Title: Re: Not getting pq_rpp and pq_curpage not being passed in POST
Post by: paramvir on May 26, 2016, 03:39:31 pm
It's because this points to js instance of the grid and this.rPP and this.curPage are undefined.

Anyway these parameters are automatically send by the grid.

Please check this example for remote paging: http://paramquery.com/pro/demos/paging
Title: Re: Not getting pq_rpp and pq_curpage not being passed in POST
Post by: stevejacobsen on May 26, 2016, 06:57:28 pm
Okay, Thanks! I was using the tutorial for PHP and they indicated to use "this". It works now.