Topic: Datepicker with multiple optuions

Joachim Kumpa priority asked 11 months ago

Expected behavior i use datepicker with the options - translations - disable future - close without confirmations

Actual behavior all options together do not work correctly and if i choose the Cancel button i have to refresh the page

Resources (screenshots, code snippets etc.) here is my code snippet:

Grzegorz Bujański staff answered 11 months ago

this is because for each element you do the component init twice. Once to disable future and again to use translations. You have two options to solve this problem:

  1. use the getOrCreateInstance() method - this method will init the component or return its instances if it is already initialized. Then use the update() method to pass the options to the component
  2. set the confirmDateOnSelect and disableFuture options using the data attributes

I have prepared a snippet in which you will find an example using the update method and passing options using data attr

Joachim Kumpa priority commented 11 months ago

That sounds very interesting and could be of great use to me. Where i can find this snippet ? Or how do I get access?

Grzegorz Bujański staff commented 11 months ago

Sorry about that. The link did not appear in my post.

Joachim Kumpa priority commented 11 months ago

Thank you very much for the snippet. I've built it into my pages and it works flawlessly. You have helped me a lot.

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 6.4.1
  • Device: Desktop
  • Browser: Firefox, Edge
  • OS: win 11
  • Provided sample code: No
  • Provided link: Yes