Skip to content

datepicker not working #188

Closed
Closed

Description

@glerendegui

Date form fields are not working. The datepicker are not showed.
I have a template like Default/form.html.twig with

            $('input').iCheck({
                checkboxClass: 'icheckbox_square-blue',
                radioClass: 'iradio_square-blue',
                increaseArea: '20%' // optional
            });
            $('select').select2();
            $('[data-datepicker="on"]').datepicker({autoclose: true});
            $('[data-timepicker="on"]').timepicker();

but nothing happens. When I have looked inside bootstrap-datepicker.js I have found that data-dapicker is something used inside the library, so, after change my code to:
$('[data-datepickerenable="on"]').datepicker({autoclose: true});

and after change form-theme.html.twig, block date_widget for
{% set attr = attr|merge({'class' : class, 'data-datepicker enable':'on'}) %}

it started working.

Debug info

Component Version
Symfony version 3.2
AdminThemeBundle dev-master

Activity

  1. added this to the Version 2.0 Stable milestone on Oct 13, 2017
  2. self-assigned this
    on Oct 16, 2017
  3. shakaran commented on Oct 16, 2017

    @shakaran
    Collaborator

    @glerendegui I push a fix now following your comment, please test latest master and let me know if work fine for you, thanks!

  4. glerendegui commented on Oct 20, 2017

    @glerendegui
    Author

    @shakaran The fix it's not working because my original copy has an error.
    data-datepicker cant be used.
    The fix its to use:
    {% set attr = attr|merge({'class' : class, 'data-datepickerenable':'on'}) %}

    data-datepickerenable without spaces. It can be "data-datepicker_enable" or anything but "data-datepicker" because that's used by the javascript plugin.

  5. shakaran commented on Oct 27, 2017

    @shakaran
    Collaborator

    @glerendegui pushed the change, let me know if the fix works for you

  6. shakaran commented on Nov 2, 2017

    @shakaran
    Collaborator

    @glerendegui ping again, please let me know the status so I can close this issue, thanks!

  7. glerendegui commented on Nov 16, 2017

    @glerendegui
    Author

    I can confirm that it's fixed. I'm sorry for the delay.

  8. shakaran commented on Nov 16, 2017

    @shakaran
    Collaborator

    @glerendegui Thanks a lot ;) Closing the issue

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions