Author Topic: Pager to exclude newly added rows  (Read 2347 times)

dbadmin

  • Pro Economy
  • Jr. Member
  • *
  • Posts: 67
    • View Profile
Pager to exclude newly added rows
« on: January 24, 2015, 03:45:10 am »
Hi,

I'm using remote paging, and I'm adding some rows dynamically upon a user action. I keep a local copy of user-added rows and add them manually in "getData" event. Then I add up whatever is gotten from server, so the final grid data consists of 2 datasets: user added and server returned.

Now the pager seems to include "user added" rows in total count (shows always 20 rows, even though 10 of them may be just user added, and I'd like to show 10+20), so I'd like to avoid that. Is there any way to do it? I tried to set "rpp" option in "getData" event to include new rows count, but that didn't help.

Thanks!

Here's my code:
getData: function (dataJSON)
           {
              
               var data = dataJSON.DataArray;
               if (data == null)
               {
                  data = new Array();
              }
              // insert pending requests at the top
               for (var i = 0; i < pendingRequestList.length; i++)
             {
                   data.push(pendingRequestList);                   
             }
            
            $( "#grid_array" ).pqGrid( "option", "rPP",  pendingRequestList.length + 20); // 20 is initial records per page value
            return { curPage: dataJSON.curPage,  totalRecords: dataJSON.totalRecords, data: data };
« Last Edit: January 24, 2015, 03:48:01 am by dbadmin »

dbadmin

  • Pro Economy
  • Jr. Member
  • *
  • Posts: 67
    • View Profile
Re: Pager to exclude newly added rows
« Reply #1 on: January 29, 2015, 10:04:19 pm »
Any thoughts?