I am using knockout binding for jQuery date picker.
Refer to jQuery UI datepicker change event not caught by KnockoutJS
The same code is working fine except I can't set datepicker options dynamically.
How to set datepicker option (like mindate max date etc) dynamically (button click) using the the above reference link?
First, you need to make the
options
object part of your view-model. Then, upon changes, update thedatePicker
with the newoptions
.This way, you can add any of the options (like
dayNames
anddateFormat
etc) to youroptions
object, and the binding handler will update the component automatically.For example (changing
minDate
dynamically):And in the binding-handler (adding subscription to changes on
options
):See Fiddle