简体   繁体   English

奏鸣曲管理员,带有选择的可编辑字段

[英]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. 我正在使用sonata admin,并且有一个选项'editable' => true可以直接编辑列表视图中的内联数据。

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 : 但是,当我单击该字段时,我不希望输入type="text" ,而是一个列表,我正在尝试类似的操作:

->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. 由于Sonata Admin Bundle 2.2选择在列表视图中接受“可编辑”参数。 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 文件: https//sonata-project.org/bundles/admin/2-2/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. 你自己的认识应该写出来。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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