简体   繁体   中英

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.

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

Other personalised field that I want is the doctrine_orm_datetime_range but with some default dates filled. I am using the date picker from genemu bundle, like in this post: Sonata Admin Bundle: DatePicker range

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

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