Author Topic: Remote Data - when empty results are returned - pager not updated  (Read 5220 times)

Webauthor

  • Pro OEM
  • Jr. Member
  • *
  • Posts: 51
    • View Profile
Hi, I use an external filter on my grid and when I search and results come back, everything works great, but if I get back an empty array, the pager does not update.  See

With results:
https://www.dropbox.com/s/wntt1ytluypngak/Screenshot%202016-08-11%2002.31.32.PNG?dl=0

With 0 results:
https://www.dropbox.com/s/pp3127h96n0rcp7/Screenshot%202016-08-11%2002.33.04.PNG?dl=0

I'm using the latest version (3.3.2).  Any insight?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Remote Data - when empty results are returned - pager not updated
« Reply #1 on: August 11, 2016, 10:39:50 pm »
I assume you have been using remote paging and remote filtering. In case of remote paging, the grid & pager takes totalRecords, curPage, data values from getData callback, so it's up to the remote script to send correct values of theses variables.

Code: [Select]
getData: function (dataJSON) {
        var data = dataJSON.data;
        return { curPage: dataJSON.curPage, totalRecords: dataJSON.totalRecords, data: data };
}

You should update the totalRecords, curPage variables on the server side scripts values when filtering takes place as they are ultimately passed on to getData callback.
« Last Edit: August 11, 2016, 10:42:47 pm by paramquery »

Webauthor

  • Pro OEM
  • Jr. Member
  • *
  • Posts: 51
    • View Profile
Re: Remote Data - when empty results are returned - pager not updated
« Reply #2 on: August 11, 2016, 10:43:12 pm »
Hi, I do return that.  In the case of an empty result set, I return 1 for curPage, 0 for totalRecords and [] for the data property.

Here's an example:

https://martin-dev.samis.io/go/view/pq-grid-test.cfm

Try adding a filter for Activity Type : Greater Than : then use 44 first, then 444 then 4444 until you see 0 results.

Any ideas why it is not updating?
« Last Edit: August 11, 2016, 10:56:34 pm by Webauthor »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Remote Data - when empty results are returned - pager not updated
« Reply #3 on: August 12, 2016, 09:16:03 am »
I was able to reproduce it. I would send you the patch/fix shortly.

Webauthor

  • Pro OEM
  • Jr. Member
  • *
  • Posts: 51
    • View Profile
Re: Remote Data - when empty results are returned - pager not updated
« Reply #4 on: August 12, 2016, 09:31:51 am »
Thank you!

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Remote Data - when empty results are returned - pager not updated
« Reply #5 on: August 12, 2016, 06:55:25 pm »
Thanks for reporting the issue.

Please find attached the patch file which can be included after pqgrid.min.js

Webauthor

  • Pro OEM
  • Jr. Member
  • *
  • Posts: 51
    • View Profile
Re: Remote Data - when empty results are returned - pager not updated
« Reply #6 on: August 13, 2016, 01:25:23 am »
Thank you so much for this.