简体   繁体   English

在configureDatagridFilters中创建自定义类型字段-Sonata Admin

[英]Create a custom type field in configureDatagridFilters - Sonata Admin

The documentation of sonata admin filter is poor of examples, and they don't show all the options of fields. Sonata管理过滤器的文档中没有很多示例,它们没有显示字段的所有选项。

So, I need to make or configure a text field and others without the operator select box before, this is too complex for simple users. 因此,我需要在没有操作员选择框的情况下创建或配置文本字段以及其他文本字段,这对于简单用户而言太复杂了。 I trying to develop a search form with a lot of fields without success. 我试图开发一个包含很多领域的搜索表单,但没有成功。 I was trying to make a custom template too. 我也在尝试制作自定义模板。 I tried what is written in this post Raw filter on Sonata Admin Bundle configureShowFields 我尝试过在Sonata Admin Bundle configureShowFields上原始筛选器中写的内容

Other personalised field that I want is the doctrine_orm_datetime_range but with some default dates filled. 我想要的其他个性化字段是doctrine_orm_datetime_range,但其中填充了一些默认日期。 I am using the date picker from genemu bundle, like in this post: Sonata Admin Bundle: DatePicker range 我正在使用Genemu包中的日期选择器,如本文中所示: Sonata Admin Bundle:DatePicker范围

Thanks! 谢谢!

It is possible to hide the operator like this: 可以这样隐藏操作符:

protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
    $datagridMapper
        ...
        ->add(
            'fieldName',
            null,
            array('operator_type' => 'hidden')
        ),
        ...
    ;
}

Cheers, Marco 干杯,马可

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

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