Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by SFGolfer on May 02, 2009 07:15
open dhtmlx forum
Custom message for empty filter results

I have filtering options setup outside of the grid which a javascript file then feeds into .php file that compiles the xml.

Is it possible to setup a custom message if there are no results found? I would like to insert a "no results found" type of message underneath the headers. Currently what appears are the headers with no rows.
Answer posted by dhxSupport on May 04, 2009 01:40
To detect if no rows was found you can use "onFilterEnd" event and getRowsNum() method;
mygrid.attachEvent("onFilterEnd",function(a,b,c){
  var num=mygrid.getRowsNum();

  if (!num) {document.getElementById("some_container").style.display="block";} // showing some container which will conatin message that no rows was found;

else document.getElementById("some_container").style.display="none";

  })



Answer posted by SFGolfer on May 05, 2009 09:12

This did not work (I'm using the standard version).

What is the purpose of function(a,b,c)?  What is 'a,b,c'?

The event does not fire if I put in a test alert:

mygrid.attachEvent("onFilterEnd",function(a,b,c){
  alert("test");
  var num=mygrid.getRowsNum();
  if (!num) {document.getElementById("some_container").style.display="block";} // showing some container which will conatin message that no rows was found;
lse document.getElementById("some_container").style.display="none";
})

Answer posted by dhxSupport on May 06, 2009 02:29
Please see example at the attachment 
Attachments (1)