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'
)
)
)
;
}
@marvoh
Copy link

marvoh commented Feb 24, 2015

The option "widget" does not exist. Known options are: "action", "attr", "auto_initialize", "block_name", "by_reference", "cascade_validation", "compound", "constraints", "csrf_field_name", "csrf_message", "csrf_protection", "csrf_provider", "csrf_token_id", "csrf_token_manager", "data", "data_class", "disabled", "empty_data", "error_bubbling", "error_mapping", "extra_fields_message", "field_options", "field_type", "horizontal_input_wrapper_class", "horizontal_label_class", "horizontal_label_offset_class", "inherit_data", "intention", "invalid_message", "invalid_message_parameters", "label", "label_attr", "label_render", "mapped", "max_length", "method", "pattern", "post_max_size_message", "property_path", "read_only", "required", "sonata_admin", "sonata_field_description", "sonata_help", "translation_domain", "trim", "validation_groups", "virtual"

@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