简体   繁体   中英

Sonata admin, editable field with choice

I'm using sonata admin and there is an option 'editable' => true for edit directly inline datas on the list view.

If my field is a text, it's ok, i can click, edit the text and save directly on the table.

But i don't want an input type="text" when i click on the field, but a list, i'm trying something like :

->add('etat', null, array('editable' => true), 'choice', array(
                'choices'   => array(
                    'Brut'   => 'Brut',
                    'NRP' => 'NRP',
                )
            ))

But no effetc.. is this possible ?

Since Sonata Admin Bundle 2.2 choice accepts the "editable" parameter in the list view. You use it like that:

$listMapper->add('etat', 'choice', [
               'choices'=>['Brut'=>'Brut', 'NRP' => 'NRP',],
               'editable'=>true,
               ]);

Doc: https://sonata-project.org/bundles/admin/2-2/doc/reference/field_types.html

It's possible for scalar values only. Hear some doc

http://sonata-project.org/bundles/admin/master/doc/reference/field_types.html

Well it's not possible at the moment and won't be possible as I can guess in the near future. Your own realization should be written.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM