# dhtmlxconnector:event_beforefilter [DHX documentation]

DHTMLX Docs & Samples Explorer

Index
dhtmlxconnector

## beforeFilter

This event occurs before data loading and allows to customize filtering of dataset

           $gridConn->event->attach("beforeFilter",handlerFunc);

In this event handlerFunc gets the following arguments:

- $filter_by - FilterInterface object

Sample of usage:

       function custom_filter($filter_by){
              //change WHERE some_field LIKE '%value%' to the WHERE some_field > 'value'
              $index = $filter_by->index("some_field");
              if ($index!==false)  //there is client side input for the filter
                   $filter_by->rules[$index]["operation"]=">";
       }
       $conn->attach->event("beforeFilter","custom_filter");