【问题标题】:Sonata Admin Bundle: How to add a "Delete" button in form, to the entities on the nested entities list?Sonata Admin Bundle:如何将表单中的“删除”按钮添加到嵌套实体列表中的实体?
【发布时间】:2018-01-30 18:23:41
【问题描述】:

在父实体中我可以这样做:

protected function configureFormFields(FormMapper $formMapper)
{

    $formMapper->add('units', 'sonata_type_collection', [
        'required' => true,
        'by_reference' => false,
        'label' => 'Units',
        'type_options' => [
            'delete' => true,
        ],
        'btn_add' => 'Add unit',
    ], [
        'edit' => 'inline',
        'inline' => 'table',
        'sortable' => 'position',
        'multiple' => true,
    ]);
}

这将显示一个删除复选框。在每个 unit 旁边有一个简单的“删除”按钮允许从列表中删除它的正确方法是什么?是否有可能以最少的配置拥有这样的东西?

【问题讨论】:

  • 我相信这是不支持的,但是一个很好的主意!
  • 你发现了吗,如何制作这个。我对最大配置也很感兴趣;)谢谢

标签: symfony symfony-sonata sonata sonata-user-bundle symfony-3.3


【解决方案1】:

我想用最少的配置是不可能的。您应该覆盖模板或制作自己的模板

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-02-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-24
    • 2016-07-09
    • 2015-01-29
    • 2015-05-30
    相关资源
    最近更新 更多