Hi ,
Trying to build own filter for numbers . >=,>,<=,< operands works well . Now wanna to add “…” , a la “BETWEEN” . Input of “10…20” must be converted to operation “between” and value “10 and 20” . So I’m analyzing input in $grid->event->attach( “beforeFilter”, “grid_serv_filter” ) :
...
$lst = true;
$p = 0;
$cVal = $filter_by->rules[ $index ][ "value" ];
$val1 = '';
$rul1 = '';
if ( strpos( $cVal, ".." ) !== false )
{
$p = strpos( $cVal, ".." );
if ( strlen( $cVal ) > $p + 2 ) // if it more than '10..'
{
$lst = false; // to avoid smallest a2
$a1 = intval( substr( $cVal, 0, $p - 1 ) );
$a2 = intval( substr( $cVal, $p + 2 ) );
ChromePhp::log( ".. - ".$cVal." p - ".$p." , a1 - ".$a1." , a2 - ".$a2 );
if ( $a2 > $a1 )
{
$val1 = substr( $cVal, 0, $p - 1 ) + " and " + substr( $cVal, $p + 2 );
$rul1 = "between";
$lst = true; // can be filtered ...
}
}
}
...
if ( $lst == true )
{
if ( strlen( $val1 ) == 0 ) // only quantity no operands
$filter_by->rules[ $index ][ "operation" ] = " = ";
else // exist operands ...
{
$filter_by->rules[ $index ][ "operation" ] = " ".$rul1." ";
$filter_by->rules[ $index ][ "value" ] = $val1;
}
}
But I’m geting an error of db_msqli.php “Fatal error … bla bla … line 15 …” . I can understand that here is a problem of value “10 and 20” ( for sample ) . But don’t know how to pass 2 values for that …
With best regards !