ParamQuery grid support forum

General Category => ParamQuery Pro Evaluation Support => Topic started by: lucafik on November 06, 2014, 08:34:42 pm

Title: getting current values of rPP and curPage
Post by: lucafik on November 06, 2014, 08:34:42 pm
I already have a server function for fetching pages of data. It receives a current page, and number of records per page.

I want to submit current page of the grid to that function. At the moment I am doing pageModel.curPage, but that doesnt change from its initial value.

As a result, when I page through data, I always get the first page.

var pageM = {
            type: 'remote',
            curPage: 1,
            rPP: 30,
            rPPOptions: [5, 30, 50]
        }
var dataM = {
....
getUrl: function () {
                return { url: "JqueryGridHelper.aspx", data: "cur_page=" + pageM.curPage + "&records_per_page=" + pageM.rPP  };
            },
}
Title: Re: getting current values of rPP and curPage
Post by: paramvir on November 06, 2014, 09:10:01 pm
The problem is you have been using the old instance of pageM object which is deep cloned by the jQueryUI constructor. Correct way is to take fresh instance of pageModel.

getUrl: function (ui) {
         var PM = ui.pageModel;
         return { url: "JqueryGridHelper.aspx", data: "cur_page=" + PM.curPage + "&records_per_page=" + PM.rPP  };
},
Title: Re: getting current values of rPP and curPage
Post by: lucafik on November 06, 2014, 10:03:09 pm
fast and exactly what i need, thanks a lot!