Giter Club home page Giter Club logo

Comments (7)

mikecoj avatar mikecoj commented on August 26, 2024 2

And that's an issue, will fix it in the next update!

Thank you for opening this issue!

from mcdatepicker.

mikecoj avatar mikecoj commented on August 26, 2024

Hey,

it was intentionally designed to act like that, let me explain to you why:

There are 4 main hooks that are linked to 4 specific events or actions:

  1. onOpen() hook - this hook is linked to the custom open event so every time the calendar appears (when using the open() method or by clicking on the linked input field) the calendar pops up and then the onOpen() hook does its job,

  2. onClose() hook - think of it as an opposite of onOpen() hook, the provided callback is executed every time the calendar disappears (that may be caused by using the close() method or by clicking Cancel or OK button)

  3. onSelect() hook - the provided callback is executed only when the OK button is clicked,

  4. onCancel() hook - the provided callback is executed only when the Cancel button is clicked.

Check out this example: https://jsfiddle.net/mike_cojocari/gmzfphx9/12/

You will notice that when you click on the Open button the onOpen() hook executes its callback, if you will click on the calendar OK button, the onSelect() hook does its job and after that onClose() hook executes its callback because the calendar disappears.

Same for calendar Cancel button: onCancel() hook executes its callback because you're clicking on it and after that onClose() callback because the calendar disappears.

You may be wondering, in which case only the onClose() hook is activated?

It's simple, when the calendar disappears but none of the calendar buttons were clicked, for example when using the close() method.

from mcdatepicker.

louis123562 avatar louis123562 commented on August 26, 2024

Thanks for the explanation, but the onClose hook is executed before the onCancel hook. Is this correct?

from mcdatepicker.

louis123562 avatar louis123562 commented on August 26, 2024

Perfect - me and my team were confused and had yet not way to figure out, if it was closed regularly or by cancel button :)

Thank you Mike, we really appreciate your work 👍

from mcdatepicker.

louis123562 avatar louis123562 commented on August 26, 2024

I "minified" the b7f64a6 via webpack (nice tool!) and it solves the issue :) great work!

from mcdatepicker.

mikecoj avatar mikecoj commented on August 26, 2024

Perfect, thank you!!

from mcdatepicker.

mikecoj avatar mikecoj commented on August 26, 2024

Hey, this issue is fixed in the new version,
and it can be closed!

from mcdatepicker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.