Skip to content

Commit e426a46

Browse files
committed
Less bad hack for method owerload.
1 parent a8e2d3d commit e426a46

File tree

1 file changed

+6
-23
lines changed

1 file changed

+6
-23
lines changed

jquery-ui-timepicker-addon.js

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -340,32 +340,15 @@
340340

341341
//########################################################################
342342
// the bad hack :/ override datepicker so it doesnt close on select
343+
// inspired: http://stackoverflow.com/questions/1252512/jquery-datepicker-prevent-closing-picker-when-clicking-a-date/1762378#1762378
343344
//########################################################################
344-
$.datepicker._selectDate = function(id, dateStr) {
345+
$.datepicker._selectDateOverload = $.datepicker._selectDate;
346+
$.datepicker._selectDate = function (id, dateStr) {
345347
var target = $(id);
346348
var inst = this._getInst(target[0]);
347-
var holdDatepickerOpen = (this._get(inst, 'holdDatepickerOpen') === true) ? true : false; // this line for timepicker..
348-
dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
349-
350-
if (inst.input)
351-
inst.input.val(dateStr);
352-
this._updateAlternate(inst);
353-
var onSelect = this._get(inst, 'onSelect');
354-
if (onSelect)
355-
onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback
356-
else if (inst.input)
357-
inst.input.trigger('change'); // fire the change event
358-
if (inst.inline)
359-
this._updateDatepicker(inst);
360-
else if (holdDatepickerOpen) { } // this line for timepicker..
361-
else {
362-
this._hideDatepicker();
363-
this._lastInput = inst.input[0];
364-
if (typeof (inst.input[0]) != 'object')
365-
inst.input.focus(); // restore focus
366-
this._lastInput = null;
367-
}
368-
349+
inst.inline = true;
350+
$.datepicker._selectDateOverload(id, dateStr);
351+
inst.inline = false;
369352
this._notifyChange(inst);
370353
this._updateDatepicker(inst);
371354
};

0 commit comments

Comments
 (0)