jQuery UI Widgets › Forums › Grid › Handling Empty Grids in Virtual Mode
This topic contains 2 replies, has 2 voices, and was last updated by TP_DTNA 8 years, 5 months ago.
-
Author
-
In the case where I have an empty grid, usually to indicate an empty search result, I end up with a lot of blank rows that can still be selected and scrolled through. Some of my grids also have button columns that can be activated while empty. How do I get the grids to correctly show up as empty, like they do when using virtualmode:false ?
Even on the jQWidgets demos, there’s an uncaught error (“invalid json value” (null)) that gets the grid stuck on its loading spinner. What I’m doing differently is returning an empty array instead of null, but I’m getting all these ghost rows instead of an empty grid.
To see what I mean, simply apply a filter in one of the demo’s columns that won’t match anything.
http://www.jqwidgets.com/jquery-widgets-demo/demos/php/serverfiltering_paging_and_sorting.htm?lightIs it possible to get a real solution to this issue, or will I need to craft a workaround?
Thanks
Hi TP_DTNA,
The jqxGrid has a method called
clear
that is used to clear all loaded data. You can use to remove all data when a search result is incorrect. Here is a demo:
http://jsfiddle.net/jqwidgets/2dsfE/Best Regards,
ChristopherjQWidgets Team
http://www.jqwidgets.comThat’s a demo of how to clear the grid when clicking a button, not how to handle an empty result. At what stage of the process (involving asynchronous callbacks) do you suggest invoking an explicit clear?
The search result is correct in returning zero results, but what is incorrect is how the grid handles that input. Am I asking too much for that simple feature to work correctly like it does in other cases that don’t use virtual mode?
I think I found the exact problem and a neat fix. (jqw version 4.3.0) in jqxdata.js:1838 I changed this line:
if (requestedData.totalrecords) {
to this:
if (requestedData.totalrecords || requestedData.totalrecords === 0) {
and that appears to have resolved the problem completely. I’ll add this patch along with the other fixes in my build process, but it would be nice to get real solutions to issues like this.
-
AuthorPosts
You must be logged in to reply to this topic.