Topic: Update settings for datepicker after initialization
Giacomoni free asked 4 years ago
Expected behavior
I would like to be able to reset & change the settings on a given datepicker object after I have initialized it. Is this possible?
How do I programmatically
- clear the currently selected date
- change the available days on the object
Actual behavior
the code example below stacks multiple copies of the calendar object on the same input field.
Resources (screenshots, code snippets etc.)
// initialize based on default selected pickup location
$('#pickup-date').datepicker({
firstDay: true,
min: true,
max: 9,
format: 'dddd – m/dd/yyyy',
disable: [true, [pickup_ready_day.year(), pickup_ready_day.month(), pickup_ready_day.date()]]
})
// chose new pickup location with different available pickup day.
// clear chosen date ???
$('#pickup-date').datepicker({
disable: [true, [pickup_ready_day.year(), pickup_ready_day.month(), pickup_ready_day.date()]]
})
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Status
Opened
Specification of the issue
- ForumUser: Free
- Premium support: No
- Technology: MDB jQuery
- MDB Version: 4.18.0
- Device: osx
- Browser: edge
- OS: osx
- Provided sample code: No
- Provided link: No
Grzegorz Bujański staff commented 4 years ago
Hi. This is not possible at the moment.
Giacomoni free commented 4 years ago
Thank you for clarifying.
Is this something that is likely in the near future or should I replace the DOM element to install an update calendar?
thanks.
Grzegorz Bujański staff commented 4 years ago
At the moment it is not possible. This option is only available in MDB 5. In MDB 4, simply removing and re-adding the timepicker with the desired options should help, but remember that it will not remove the class instance from memory.
Giacomoni free commented 4 years ago
Thanks for the clarification.
I'll begin looking at MDB5 but will redesign the UX for the page to not use a datepicker.
Grzegorz Bujański staff commented 4 years ago
I hope MDB5 will meet your requirements and you will achieve this effect in the future :)