Bugfix for correct timepicker injection
Prevents beforeShow from being called twice, which prevents injectTimepicker from being called twice
This commit is contained in:
parent
496ee3acfd
commit
48620930ab
20
jquery-ui-timepicker-addon.js
vendored
20
jquery-ui-timepicker-addon.js
vendored
|
@ -121,7 +121,6 @@ $.extend(Timepicker.prototype, {
|
||||||
$input.trigger("focus");
|
$input.trigger("focus");
|
||||||
});
|
});
|
||||||
tp_inst.inst = dp_inst;
|
tp_inst.inst = dp_inst;
|
||||||
tp_inst._addTimePicker();
|
|
||||||
if ($.isFunction(o.beforeShow))
|
if ($.isFunction(o.beforeShow))
|
||||||
o.beforeShow(input, dp_inst);
|
o.beforeShow(input, dp_inst);
|
||||||
},
|
},
|
||||||
|
@ -437,7 +436,7 @@ $.extend(Timepicker.prototype, {
|
||||||
},
|
},
|
||||||
|
|
||||||
//########################################################################
|
//########################################################################
|
||||||
// when a slider moves...
|
// when a slider moves, set the internal time...
|
||||||
// on time change is also called when the time is updated in the text field
|
// on time change is also called when the time is updated in the text field
|
||||||
//########################################################################
|
//########################################################################
|
||||||
_onTimeChange: function() {
|
_onTimeChange: function() {
|
||||||
|
@ -597,16 +596,7 @@ $.datepicker._updateDatepicker = function(inst) {
|
||||||
if (typeof(inst.stay_open) !== 'boolean' || inst.stay_open === false) {
|
if (typeof(inst.stay_open) !== 'boolean' || inst.stay_open === false) {
|
||||||
this._base_updateDatepicker(inst);
|
this._base_updateDatepicker(inst);
|
||||||
// Reload the time control when changing something in the input text field.
|
// Reload the time control when changing something in the input text field.
|
||||||
this._beforeShow(inst.input, inst);
|
this._get(inst, 'timepicker')._addTimePicker();
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
$.datepicker._beforeShow = function(input, inst) {
|
|
||||||
var beforeShow = this._get(inst, 'beforeShow');
|
|
||||||
if (beforeShow) {
|
|
||||||
inst.stay_open = true;
|
|
||||||
beforeShow.apply((inst.input ? inst.input[0] : null), [inst.input, inst]);
|
|
||||||
inst.stay_open = false;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -726,12 +716,8 @@ $.datepicker._setTimeDatepicker = function(target, date, withDate) {
|
||||||
//#######################################################################################
|
//#######################################################################################
|
||||||
$.datepicker._base_setDateDatepicker = $.datepicker._setDateDatepicker;
|
$.datepicker._base_setDateDatepicker = $.datepicker._setDateDatepicker;
|
||||||
$.datepicker._setDateDatepicker = function(target, date) {
|
$.datepicker._setDateDatepicker = function(target, date) {
|
||||||
var inst = this._getInst(target),
|
|
||||||
tp_date = new Date(date.getTime());
|
|
||||||
|
|
||||||
this._updateDatepicker(inst);
|
|
||||||
this._base_setDateDatepicker.apply(this, arguments);
|
this._base_setDateDatepicker.apply(this, arguments);
|
||||||
this._setTimeDatepicker(target, tp_date, true);
|
this._setTimeDatepicker(target, date, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
//#######################################################################################
|
//#######################################################################################
|
||||||
|
|
Loading…
Reference in a new issue