Skip to content

Instantly share code, notes, and snippets.

@aginanjar
Created December 27, 2014 16:48
Show Gist options
  • Save aginanjar/3a3540def31f980723ac to your computer and use it in GitHub Desktop.
Save aginanjar/3a3540def31f980723ac to your computer and use it in GitHub Desktop.
Implement doctrine datetime picker range on Sonata Admin Filter by @webdevilovers
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
...
->add('createdAt', 'doctrine_orm_datetime_range', array(),
'sonata_type_date_range',
array(
'required' => false,
'widget' => 'single_text',
'attr' => array(
'class' => 'datepicker',
'data-date-format' => 'YYYY-MM-DD'
)
)
)
;
}
@webdevilopers
Copy link

Related issue:
sonata-project/SonataAdminBundle#2148

The widget option is gone. Currently there is no way to get a single text field to get a datepicker - just single selects.

But there is a discussion for this feature:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment