Class Options
The Options class provides a convenient method of specifying where Editor
should get the list of options for a select
, radio
or checkbox
field.
This is normally from a table that is left joined to the main table being
edited, and a list of the values available from the joined table is shown to
the end user to let them select from.
Options
instances are used with the Field::options method.
- DataTables\Ext
-
DataTables\Editor\Options
Namespace: DataTables\Editor
Example:
Example:
Example:
Located at Editor/Options.php
Example:
Get a list of options from the sites
table
Field::inst( 'users.site' ) ->options( Options::inst() ->table( 'sites' ) ->value( 'id' ) ->label( 'name' ) )
Example:
Get a list of options with custom ordering
Field::inst( 'users.site' ) ->options( Options::inst() ->table( 'sites' ) ->value( 'id' ) ->label( 'name' ) ->order( 'name DESC' ) )
Example:
Get a list of options showing the id and name in the label
Field::inst( 'users.site' ) ->options( Options::inst() ->table( 'sites' ) ->value( 'id' ) ->label( [ 'name', 'id' ] ) ->render( function ( $row ) { return $row['name'].' ('.$row['id'].')'; } ) )
Located at Editor/Options.php
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
_getSet(),
_propExists(),
_readProp(),
_writeProp(),
inst(),
instantiate()
|