Don't open another date/timepicker when there's already one showing.

(Partially) fixes #28, #56 and #101
This commit is contained in:
Alexander Gitter 2011-06-11 22:13:54 +02:00
parent 2e9005b2e8
commit d9da87bfb7

View file

@ -798,6 +798,16 @@ $.datepicker._selectDate = function (id, dateStr) {
//############################################################################################# //#############################################################################################
$.datepicker._base_updateDatepicker = $.datepicker._updateDatepicker; $.datepicker._base_updateDatepicker = $.datepicker._updateDatepicker;
$.datepicker._updateDatepicker = function(inst) { $.datepicker._updateDatepicker = function(inst) {
// don't popup the datepicker if there is another instance already opened
var input = inst.input[0];
if($.datepicker._curInst &&
$.datepicker._curInst != inst &&
$.datepicker._datepickerShowing &&
$.datepicker._lastInput != input) {
return;
}
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);