diff options
author | Patrick McKay <patrick.mckay@vumc.org> | 2020-03-01 07:13:05 -0600 |
---|---|---|
committer | Felix Nagel <fnagel@users.noreply.github.com> | 2021-05-21 17:58:10 +0200 |
commit | 17d115b8298b935ab0d26b881d4f6f3e83984868 (patch) | |
tree | a5e01e37af5a3a2ccf21285b11a962584aaaef17 /ui/widgets/datepicker.js | |
parent | b864cd103a0acb76b0a34fb1dd382dc0925ef9a8 (diff) | |
download | jquery-ui-17d115b8298b935ab0d26b881d4f6f3e83984868.tar.gz jquery-ui-17d115b8298b935ab0d26b881d4f6f3e83984868.zip |
Datepicker: Add option for onUpdateDatepicker callback
Add a new option named onUpdateDatepicker that allows a custom callback
to be provided. If provided, the callback is called at the end of
$.datepicker._updateDatepicker.
Diffstat (limited to 'ui/widgets/datepicker.js')
-rw-r--r-- | ui/widgets/datepicker.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ui/widgets/datepicker.js b/ui/widgets/datepicker.js index 830dc5863..d363c8fc6 100644 --- a/ui/widgets/datepicker.js +++ b/ui/widgets/datepicker.js @@ -142,6 +142,7 @@ function Datepicker() { onSelect: null, // Define a callback function when a date is selected onChangeMonthYear: null, // Define a callback function when the month or year is changed onClose: null, // Define a callback function when the datepicker is closed + onUpdateDatepicker: null, // Define a callback function when the datepicker is updated numberOfMonths: 1, // Number of months to show at a time showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) stepMonths: 1, // Number of months to step back/forward @@ -857,7 +858,8 @@ $.extend( Datepicker.prototype, { numMonths = this._getNumberOfMonths( inst ), cols = numMonths[ 1 ], width = 17, - activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" ); + activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" ), + onUpdateDatepicker = $.datepicker._get( inst, "onUpdateDatepicker" ); if ( activeCell.length > 0 ) { datepicker_handleMouseover.apply( activeCell.get( 0 ) ); @@ -888,6 +890,10 @@ $.extend( Datepicker.prototype, { origyearshtml = inst.yearshtml = null; }, 0 ); } + + if ( onUpdateDatepicker ) { + onUpdateDatepicker.apply( ( inst.input ? inst.input[ 0 ] : null ), [ inst ] ); + } }, // #6694 - don't focus the input if it's already focused |