Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by dian.kwok on Sep 08, 2008 02:30
open dhtmlx forum
server side filtering using #select_filter or #text_filter in header

Hi team,

I'm trying to create a server side filtering and i have seen the examples at http://www.dhtmlx.com/docs/products/dhtmlxGrid/samples/loading_big_datasets/50000_paging.html?un=1212419720000

But i intended to use the #select_filter and/or #text_filter in header for this server side filtering.
i still don't know whether there's an event in grid which can be used for this.

is there any way to do that?or custom code example for doing it?

Thanks in advance.
Answer posted by Support on Sep 08, 2008 05:11
The built in filters , such as #text_filter or #select_filter not intended to be used with server side sorting, they are purposed for client side sorting only. 

>>i still don't know whether there's an event in grid which can be used for this.
grid has two events
 onFilterStart
 onFilterEnd

you can try to use something similar to 

grid.attachEvent("onFilterStart",function(a,b){
  //a - array of column indexes
  //b - array of filter values
   var str = somehow(a,b);
   grid.clearAll();
   grid.loadXML(a,b);
   return false; // block default
});

Beware that #select_filter will not work in case of dyn. loading in any case ( it will not be able to collect possible values )

Instead of using #text_filter and #select_filter you can place just custom HTML inputs in header and attach to them onChange or onKeypress events to trigger code for server side filtering
Answer posted by dian.kwok on Sep 08, 2008 21:32
i tried to implement below code :
grid.attachEvent("onFilterStart",function(a,b){
                 alert(a);
                 return false;
                })
but the result is undefined for a and b variable.
did i use the wrong code?
Answer posted by Support on Sep 09, 2008 02:34
Please try to use attached js file instead of original one. 
The version of dhtmlxgrid_filter.js included in original package doesn't support necessary parameters of event. 
Attachments (1)