ParamQuery grid support forum
General Category => Bug Report => Topic started 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?
-
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.
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.
-
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?
-
I was able to reproduce it. I would send you the patch/fix shortly.
-
Thank you!
-
Thanks for reporting the issue.
Please find attached the patch file which can be included after pqgrid.min.js
-
Thank you so much for this.