ParamQuery grid support forum

General Category => Bug Report => Topic started by: Webauthor on August 11, 2016, 12:04:02 pm

Title: Remote Data - when empty results are returned - pager not updated
Post by: Webauthor on August 11, 2016, 12:04:02 pm
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?
Title: Re: Remote Data - when empty results are returned - pager not updated
Post by: paramvir 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.
Title: Re: Remote Data - when empty results are returned - pager not updated
Post by: Webauthor 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?
Title: Re: Remote Data - when empty results are returned - pager not updated
Post by: paramvir on August 12, 2016, 09:16:03 am
I was able to reproduce it. I would send you the patch/fix shortly.
Title: Re: Remote Data - when empty results are returned - pager not updated
Post by: Webauthor on August 12, 2016, 09:31:51 am
Thank you!
Title: Re: Remote Data - when empty results are returned - pager not updated
Post by: paramvir 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
Title: Re: Remote Data - when empty results are returned - pager not updated
Post by: Webauthor on August 13, 2016, 01:25:23 am
Thank you so much for this.