how to filter select fields options ?
how to filter select fields options ?
I try to set where clause when getting option list, and try a lot but nothing run
Editor::inst( $db, $TblName )
->fields(
Field::inst( 'documents.Operation' )
->options( Options::inst()
->table( 'operations' )
->value( 'ID' )
->label('Libelle')
// not run
// -> where('ID',$F)
// $F is set at start and this part (global select) is ok
// ->where('documents.Operation',($F)?$F:0,'>')
// ->process( $_POST )
// ->json();
// not run - $F is set at start but not visible for the select field filter function
->where( function($q, $F) {
$q ->where( function($r) {
$r ->where('ID',($F)?$F:0,'>');
});
} )
Does somebody do that please, or an idea?
Thanks by advance
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You need to do this:
That's how you access externally scoped variables in PHP anonymous functions. See the PHP docs for full details.
Allan
Thanks a lot again
in fact there were 2 mistake in my code (use () and ? : choice... ever the > operator was set