Skip to content

Commit e0924c4

Browse files
author
Rômulo Göelzer Portolann Malkiewiez
committed
Datepicker: Add option for onUpdateDatepicker callback [SO-2932013]
1 parent 76a7d02 commit e0924c4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ui/datepicker.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ function Datepicker() {
127127
onSelect: null, // Define a callback function when a date is selected
128128
onChangeMonthYear: null, // Define a callback function when the month or year is changed
129129
onClose: null, // Define a callback function when the datepicker is closed
130+
onUpdateDatepicker: null, // Define a callback function when the datepicker is updated
130131
numberOfMonths: 1, // Number of months to show at a time
131132
showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
132133
stepMonths: 1, // Number of months to step back/forward
@@ -808,7 +809,8 @@ $.extend(Datepicker.prototype, {
808809
numMonths = this._getNumberOfMonths(inst),
809810
cols = numMonths[1],
810811
width = 17,
811-
activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" );
812+
activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" ),
813+
onUpdateDatepicker = $.datepicker._get( inst, "onUpdateDatepicker");
812814

813815
if ( activeCell.length > 0 ) {
814816
datepicker_handleMouseover.apply( activeCell.get( 0 ) );
@@ -838,6 +840,10 @@ $.extend(Datepicker.prototype, {
838840
origyearshtml = inst.yearshtml = null;
839841
}, 0);
840842
}
843+
844+
if ( onUpdateDatepicker ) {
845+
onUpdateDatepicker.apply( ( inst.input ? inst.input[ 0 ] : null ), [ inst ] );
846+
}
841847
},
842848

843849
// #6694 - don't focus the input if it's already focused

0 commit comments

Comments
 (0)