ASP.NET MVC3 / jQuery 1.9.1 / jQuery UI 1.10.2
I\'ve got a page on which I open a modal dialog after clicking on an Ajax.ActionLink. Inside this dialog
I wanted to re-inititalise the date picker after modal close as the values selected during the first trial for setting of the dates were still there. So i dont know why but the following code doesnt work for me.
$(selector).datepicker("refresh")
The above line mentioned in the documentation didnt help!.
Following is something which i tried, i.e to destroy and reinititalise the date picker objects.
$('#addPromoModal').on('hide.bs.modal', function(event) {
$("#startDate").datepicker("destroy");
$("endDate").datepicker("destroy");
initialiseDataPicker(); }
Here is my initialise function :
function initialiseDataPicker(){
$( "#startDate" ).datepicker({
defaultDate: "+1w",
showWeek: true,
firstDay: 1,
changeMonth: true,
// numberOfMonths: 3,
onClose: function( selectedDate ) {
$( "#endDate" ).datepicker( "option", "minDate", selectedDate );
}
});
$( "#endDate" ).datepicker({
defaultDate: "+1w",
showWeek: true,
firstDay: 1,
changeMonth: true,
// numberOfMonths: 3,
onClose: function( selectedDate ) {
$( "#startDate" ).datepicker( "option", "maxDate", selectedDate );
}
});
}
Hope That helps! RA