It would be possible for Editor users to have a complete example to use select2 instead of select especially in edit?.
Using select2 instead of edit without modifying php works perfectly but in the edit mode does not preserve the value of the field...
Field::inst( 'clienti.cli_naz' )
->options( Options::inst()
->table( 'nazioni' )
->value( 'naz_cod' )
->label( ['naz_nome','naz_cod'] )
->render( function ( $row ) {
return $row['naz_nome'].' ('.$row['naz_cod'].')';
} )
->order( 'naz_nome ASC' )
)
{
label: "Nazione",
name: "clienti.cli_naz",
type: "select2",
opts: {
// placeholder: "",
allowClear: false,
initialValue: true,
},
// type: "select",
// def: "IT",
// placeholderDisabled: true
},
Thank you,
Giuseppe