There is an even cleaner solution!
I was facing the same problem, and discovered the _refreshDatepicker method
which is built to do exactly what you want. To call it, simply run:

jQuery("#date-pick").datepicker("refresh");


Autre Monde wrote:
> 
> 
> Hello,
> 
> First of all, let me say that jQuery is really awesome! And what about
> the UI Datepicker, it is just amazing! Congratulations to all the
> designers of this wonderfull solution.
> 
> I have been using jQuery UI Datepicker for few weeks now. I am at a
> stage where I need to refresh it in my code.
> 
> Basically, I am displaying an inline Datepicker initialized with this
> code :
> jQuery('#date-pick').datepicker
> ({beforeShowDay:DaysOff,rangeSelect:true,numberOfMonths:2,inline:true,
> rangeSeparator: ' au
> ',onSelect:updateInlineRange,minDate:"-1y",maxdate:"1y"});
> jQuery('#date-pick').find('div:first').width(370);
> 
> When some actions are performed, I have an ajax call that updates the
> filters (used in DaysOff). So I would need to refresh the Datepicker
> displayed. Unfortunately, the only I have found to achieve this is to
> destroy and recreate it :(
> jQuery('#date-pick').datepicker('destroy');
> jQuery('#date-pick').datepicker
> ({beforeShowDay:DaysOff,rangeSelect:true,numberOfMonths:2,inline:true,
> rangeSeparator: ' au
> ',onSelect:updateInlineRange,minDate:"-1y",maxdate:"1y"});
> jQuery('#date-pick').find('div:first').width(370);
> 
> The issue are the following :
> 1/ It is not clean at all to do this;
> 2/ Sounds like there are some leaks somewhere because the first time,
> it works fine, the second as well but the third time, nothing gets
> refreshed and I need to restart IE 6 to be able to make it work again
> (the refresh through the destroy).
> 
> I am using ver 1.5.3.
> 
> Cheers!
> 
> Olivier
> 
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google Groups
> "jQuery UI" group.
> To post to this group, send email to jquery-ui@googlegroups.com
> To unsubscribe from this group, send email to
> jquery-ui+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/jquery-ui?hl=en
> -~----------~----~----~----~------~----~------~--~---
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Datepicker-refresh-tp21364011s27240p26868453.html
Sent from the jQuery UI Discussion mailing list archive at Nabble.com.

--

You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to jquery...@googlegroups.com.
To unsubscribe from this group, send email to 
jquery-ui+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en.


Reply via email to