Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Bob Palin on Dec 09, 2008 14:30
open dhtmlx forum
Grid filters

I have added filtering boxes to my grid headers but I can't get them to work, as soon as I enter a keystroke in a filter box I get a JS error. (I am including dhtmlxgrid_filter.js)

row.childNodes has no properties
http://localhost/dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.js
Line 901

there is a little more information available, looks like a call stack:

cells3(0, 3)dhtmlxgrid.js (line 901)
_get_cell_value(0, 3, undefined)dhtmlxgrid.js (line 837)
_filterA(3, "1")dhtmlxgrid_filter... (line 18)
filterBy([1, 2, 3, 7 more...], ["", "", "1", 7 more...], undefined)dhtmlxgrid_filter... (line 15)
filterByAll()dhtmlxgrid_filter... (line 23)
onkeydown()

The first line of my readme.txt file says:
dhtmlxSuite 2008 Rel.3 (DHTMLX 2.0) Professional edition build 81009/81107
Answer posted by Support on Dec 10, 2008 01:36
How do you loading data in grid?
The above error can occurs in next cases

a) non-unique row IDs
b) you are using filters and dynamic loading ( dyn. paging or dyn. smart rendering ) at the same time. ( filtering can't be used in dyn. loading mode) 
c) you have added rows by grid.addRow with incorrect indexes.

Answer posted by Bob Palin on Dec 10, 2008 05:34
Thank you, I am using dynamic loading, is there a way to use the boxes with my own filtering scheme? i.e. can I trap the keystrokes in the filter boxes and interpret them myself? If this is covered in the Docs would you point me to the correct section please.
Answer posted by Support on Dec 10, 2008 06:41
You can use onFilterStart event 

mygrid.attachEvent("onFilterStart",function(columns,data){
     //data - array of filter values
      this.clearAll();
      this.loadXML("some.php?data=".data.join(";")); //load url with custom filtering parameters
     return false;
});