Fix for altField option when using inline picker

This commit is contained in:
Trent Richardson 2011-01-05 09:21:03 -05:00
parent c1d7c5a106
commit 60ffcebe5c

View file

@ -125,13 +125,7 @@ $.extend(Timepicker.prototype, {
} }
} }
tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, o, { tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, o, {
beforeShow: function(input, dp_inst) { beforeShow: function(input, dp_inst) {
if (o.altField)
tp_inst.$altInput = $($.datepicker._get(dp_inst, 'altField'))
.css({ cursor: 'pointer' })
.focus(function(){
$input.trigger("focus");
});
if ($.isFunction(o.beforeShow)) if ($.isFunction(o.beforeShow))
o.beforeShow(input, dp_inst); o.beforeShow(input, dp_inst);
}, },
@ -150,6 +144,11 @@ $.extend(Timepicker.prototype, {
timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker'); timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker');
}); });
if (o.altField)
tp_inst.$altInput = $(o.altField)
.css({ cursor: 'pointer' })
.focus(function(){ $input.trigger("focus"); });
// datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime.. // datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime..
if(tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date) if(tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date)
tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime()); tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime());