Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to trigger open? #2

Open
youradds opened this issue Mar 5, 2018 · 3 comments
Open

How to trigger open? #2

youradds opened this issue Mar 5, 2018 · 3 comments
Assignees

Comments

@youradds
Copy link

youradds commented Mar 5, 2018

Hi,

Cool plugin :) I'm trying to make it so the datepicker is only init'd when they focus on it. As such, I need it to open right after adding. How do I do this? I've tried:

   handleEvent(document, 'click', '.date-from-to-top', function(e) {

        var thePicker = this.closest("input");

        if (thePicker.classList.contains("date-picker-x-input") == false) {
            thePicker.DatePickerX.init({
                    mondayFirst: true,
                    minDate    : new Date()
            });
            this.dispatchEvent(new MouseEvent(what));
        }

    });

Thanks

Andy

@AlexKrupko
Copy link
Owner

Hi @youradds!

I think you need just dispatch click event for input element.
Try following thePicker.dispatchEvent(new MouseEvent(what));

Thanks

@youradds
Copy link
Author

Thanks @SanychZp - unfortunately this killed it for me, and I've had to move over to another plugin. Real shame, as it was a cool plugin otherwise :(

What it could probably do with, is an option you can pass in, so that when you create the calendar it opens on its own. Something like:

openOnCreate: true

:)

@AlexKrupko AlexKrupko added this to the 1.0.5 milestone Mar 13, 2018
@AlexKrupko AlexKrupko self-assigned this Mar 13, 2018
@AlexKrupko
Copy link
Owner

Thanks @youradds

I'll add such option in one of next versions.

@AlexKrupko AlexKrupko removed this from the 1.0.5 milestone Jun 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants