Need help on onBeforeFilter event

I am trying to change the behaviour of the header #connector_text_filter. It is working as “LIKE %value%”, but I’d like to use it as “LIKE %value”. I am trying to do this with the onBeforeFilter event, without success.

I found this:
viewtopic.php?f=19&t=17838&p=55530&hilit=beforefilter#p55530

so I am trying to do something like this on server side, but it doesn’t work as I expected:

[code]
$gridConn->event->attach(“beforeFilter”,“custom_filter”);

$gridConn->render_table("grid50","item_id","item_nm,item_cd");


function custom_filter($filter){
    $index = $filter->index("item_nm");
    if($index == 1){
		$name = $filter->rules[$index]["value"];
		$value = $filter->rules[$index]["value"];
	    $filter->rules[$index] = $name." LIKE '%".$value."'";   
    }
	return true;
}
[/code]

Is there any chance to do this, or in worst case I will have to downgrade to an earlier connector, which can be used as:

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

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

Thanks in advance.

Your code looks fine, except of the next lines

if($index == 1){ $name = $filter->rules[$index]["value"];
which must be

[code]if($index !== false){
$name = $filter->rules[$index][“name”];

[/code]

Thanks a lot, now it is working fine.