Author Topic: Records Per Page is not working fine in last page  (Read 2549 times)

jeeva

  • Newbie
  • *
  • Posts: 29
    • View Profile
Records Per Page is not working fine in last page
« on: June 07, 2017, 01:15:07 pm »
Dear Support,

I am using remote pagination.
pageModel: { type:'remote',rPP: 50,rPPOptions:[50,100,200,300,500]},

when I am in last page and trying to change records per page drop down as 500.Its Sending   pq_curpage=4&pq_rpp=500&_=1496820976665"

Its returning no data found.but its having 300 records

pq_curpage=4 should be 1, then only can get all the data in grid.Can you please help me to fix this.

thanks
jeeva


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Records Per Page is not working fine in last page
« Reply #1 on: June 20, 2017, 09:42:51 am »
Please use this logic in the remote script to correct the number of skipped records.

Code: [Select]
int skip = (pq_rpp * (pq_curpage - 1));
        if (skip >= total_Records)
        {
            pq_curpage = (int)Math.ceil(((double)total_Records) / pq_rpp);
            skip = (pq_rpp * (pq_curpage - 1));
        }

as shown in this example for remote paging: https://paramquery.com/pro/demos/paging