datagrid filter for relation object as text field (insted of dropdown) in sonata admin in symfony 2.4

主宰稳场 提交于 2019-12-04 06:41:22

I needed something like this on a project. I implemented this feature using this. You can try to set the 'field_type' option to 'text' (I used 'choice' in the project I worked at) and add the querybuilder actions you need to filter.

Use doctrine_orm_choice option.

protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
    $datagridMapper->add(
            'module',
            'doctrine_orm_choice',
            [],
            'choice',
            [
                'choices' => $this->filterModuleList
            ]
        )

        ....
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!