Really like datepicker. Thanks a lot for this great library!
I have got one question for you based in this example (inline datepicker):
http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/datePickerMultiMonth5.html
I added a "renderCallback" function to disable week days based on checkboxes... (e.g. when saturday-checkbox is checked disable all saturdays shown).
This works perfectly fine when initializing the calender with datePickerMultiMonth().
But how can I refresh the inline calender when one of the checkboxes is changed (e.g. deselect monday-checkbox)?
As-is: when I select / deselect a checkbox the datepicker remains unchanged.. only after manually changing to the next month it updates and disables e.g. all mondays... this should immediately happen when changing the monday-checkbox.
Do you have any idea how I can refresh the datepicket? Thanks a lot for your help!
Cheers, Markus
You can find it on http://jqueryui.com/demos/datepicker/#method-refresh click the "Methods" tab
After having a bit of a look at the source, it seems you'll have to do something like this:
or possibly this:
The
$.event._dpCache[$('.date-pick')[0]._dpId]
part is used to get the first internal DatePicker object matching the css'.date-pick'
, which is needed to access the internal_applyRenderCallbacks
and_rerenderCalendar
functions.Unfortunately, this does access the internal structure of the plugin, so it is possible it might break when new versions are released, however I couldn't find any publicly accessible way to refresh the calendar.
Probably the easiest way to solve the problem is to remove the existing calendar and then rerender it. e.g.:
However, this has some drawbacks as the state of your date picker isn't maintained (e.g. displayed month, selected dates etc).
So I just made some changes to the plugin and introduced a new method:
dpmmRerenderCalendar
on the multimonth picker (and the correspondingdpRerenderCalendar
on the date picker itself).You can see an example of it in action here:
http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/datePickerMultiMonth7.html
And can grab the latest plugin code from my site or the googlecode repository.