Topic: Datepicker with multiple optuions
Joachim Kumpa pro premium priority asked a year 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: https://mdbootstrap.com/snippets/standard/kumpa/5530715
Grzegorz Bujański staff answered a year 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:
- use the
getOrCreateInstance()
method - this method will init the component or return its instances if it is already initialized. Then use theupdate()
method to pass the options to the component - set the
confirmDateOnSelect
anddisableFuture
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 pro premium priority commented a year 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 a year ago
Sorry about that. The link did not appear in my post. https://mdbootstrap.com/snippets/standard/grzegorz-bujanski/5534007
Joachim Kumpa pro premium priority commented a year 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.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- 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