custom filtering

Hello dhtmlxSupport,

since dhtmlxConnector 1.x a custom function called by the ‘beforeFilter’-event has an object as (obviously single) parameter. We can manipulate filter data on this object like this

$index = $filter_by->index("some_field"); if ($index!==false) //there is client side input for the filter $filter_by->rules[$index]["operation"]=">";

… as written in the docs.

In a former version we had two parameters $col and $mask and were able to write custom filter queries like this:

[code]$gridConnector->event->attach(“beforeFilter”, “manageFilters”);

function manageFilter($col, $mask){
$like = $column." LIKE ‘%“.$mask.”%’";
return $like;
}[/code]

To be up2date, i updated dhtmlxDataProcessor and dhtmlxConnector libraries on a former project.

Now I need those custom filtering because the filter query is filled with 'AND’s, 'OR’s and more than one column. Is that possible with dhtmlxConnector 1.0 ?

I will give you an example of how the filter query should look like:

CURRENT_TIMESTAMP < col1 AND col2 = 0

Thanks in advance,
Peter

I got the solution when i took a look inside the connector source code.

You have the option to use

  • name
  • operation
  • value

as array index for $filter->rules[$index].

But you can treat $filter->rules[$index] as string as well for custom filter SQL-code.

Maybe you should update the docs and/or examples to show that there aretwo ways.

Yep, existing documentation is not very clear about that moment - we will update it.