How to create custom filter types in Sonata Admin Bundle

2,417 views
Skip to first unread message

Daniel Peraza

unread,
May 22, 2014, 11:17:17 PM5/22/14
to sonata...@googlegroups.com
Hello, I'm new to S.A.B. and I need to know how can I code my own custom filter types, since using the native Symfony 2's Form Types doesn't seem to suffice. 

One point I'm specially interested in are the date time types, since SAB does not take advantage of the new HTML5 date-time input type. I'd like to use the built in datetime input type and use HTML5 Web Shims to provide support for older browsers.

Hugo Briand

unread,
May 23, 2014, 2:50:52 AM5/23/14
to sonata...@googlegroups.com
Hello,

If you take a look at the most recent PRs on SonataAdminBundle and SonataCoreBundle you'll find how we added a DatePicker to the admin (both forms and filters). Hope that helps :)

Envoyé de mon téléphone intelligent. 

Le 23 mai 2014 à 05:17, Daniel Peraza <daniel...@gmail.com> a écrit :

Hello, I'm new to S.A.B. and I need to know how can I code my own custom filter types, since using the native Symfony 2's Form Types doesn't seem to suffice. 

One point I'm specially interested in are the date time types, since SAB does not take advantage of the new HTML5 date-time input type. I'd like to use the built in datetime input type and use HTML5 Web Shims to provide support for older browsers.

--
You received this message because you are subscribed to the Google Groups "sonata-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonata-users...@googlegroups.com.
To post to this group, send email to sonata...@googlegroups.com.
Visit this group at http://groups.google.com/group/sonata-users.
For more options, visit https://groups.google.com/d/optout.

Daniel Peraza

unread,
May 29, 2014, 4:22:09 AM5/29/14
to sonata...@googlegroups.com
Thank you Hugo, but I'd appreciate you point me to some link. I've taken a look to it as you suggested, but couldn't find anything useful.

Again, thank you for your help.

Hugo Briand

unread,
May 30, 2014, 4:41:50 AM5/30/14
to sonata...@googlegroups.com

Daniel Peraza

unread,
Jun 1, 2014, 3:12:53 AM6/1/14
to sonata...@googlegroups.com
In configureDatagridFilters() I'm doing this:

$datagridMapper->->add('startTime', null, array(), 'sonata_type_datetime_picker')

also tried this:

$datagridMapper->->add('startTime', 'doctrine_orm_datetime', array('input_type' => 'sonata_type_datetime_picker') )

But still can't accomplish the desired results.

discu...@webdevilopers.net

unread,
Sep 8, 2014, 5:31:41 AM9/8/14
to sonata...@googlegroups.com
$datagridMapper->->add('startTime', null, array(), 'sonata_type_datetime_picker');

works fine with me.

Sergio Rebollo

unread,
Oct 6, 2014, 4:10:39 AM10/6/14
to sonata...@googlegroups.com
Thanks!!!!

I want to do this, but with range.

This works for me:

http://stackoverflow.com/questions/14443558/sonata-admin-bundle-datepicker-range

But it does not show the icon of the field.
Reply all
Reply to author
Forward
0 new messages