summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkumm <kumm@mofli.(none)>2011-01-17 22:25:27 +0100
committerkumm <kumm@mofli.(none)>2011-01-17 22:25:27 +0100
commit5d05d23fa61cdbcd58cb70e717dcd02527752750 (patch)
tree926f255aa702389ee7cc09e6cf3fb93cd9a01a07
parent44fc32ab449a2a0575070821b0f28d2c3dfa9735 (diff)
downloadjQuery-Timepicker-Addon-5d05d23fa61cdbcd58cb70e717dcd02527752750.zip
jQuery-Timepicker-Addon-5d05d23fa61cdbcd58cb70e717dcd02527752750.tar.gz
jQuery-Timepicker-Addon-5d05d23fa61cdbcd58cb70e717dcd02527752750.tar.bz2
Support datepicker onSelect handler.
-rw-r--r--jquery-ui-timepicker-addon.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/jquery-ui-timepicker-addon.js b/jquery-ui-timepicker-addon.js
index d88c613..9dd6b6a 100644
--- a/jquery-ui-timepicker-addon.js
+++ b/jquery-ui-timepicker-addon.js
@@ -457,6 +457,18 @@ $.extend(Timepicker.prototype, {
this._onTimeChange();
this.timeDefined = timeDefined;
}
+
+ //Emulate datepicker onSelect behavior. Call on slidestop.
+ var onSelect = tp_inst._defaults['onSelect'];
+ if (onSelect) {
+ var inputEl = tp_inst.$input ? tp_inst.$input[0] : null;
+ var onSelectHandler = function() {
+ onSelect.apply(inputEl, [tp_inst.formattedDateTime, tp_inst]); // trigger custom callback*/
+ }
+ this.hour_slider.bind('slidestop',onSelectHandler);
+ this.minute_slider.bind('slidestop',onSelectHandler);
+ this.second_slider.bind('slidestop',onSelectHandler);
+ }
}
},
@@ -688,7 +700,8 @@ $.datepicker._selectDate = function (id, dateStr) {
if (tp_inst) {
tp_inst._limitMinMaxDateTime(inst, true);
inst.inline = inst.stay_open = true;
- this._base_selectDate(id, dateStr);
+ //This way the onSelect handler called from calendarpicker get the full dateTime
+ this._base_selectDate(id, dateStr + tp_inst._defaults.separator + tp_inst.formattedTime);
inst.inline = inst.stay_open = false;
this._notifyChange(inst);
this._updateDatepicker(inst);