Skip to content

Commit f547fa4

Browse files
Control updates - can pass object to controlType
1 parent 6e0c31a commit f547fa4

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

jquery-ui-timepicker-addon.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,16 @@
208208
return val.toUpperCase();
209209
});
210210

211-
// select control type will always be available
212-
if(tp_inst._defaults.controlType == 'slider' && $.fn.slider === undefined){
213-
tp_inst._defaults.controlType = 'select';
211+
// controlType is string - key to our this._controls
212+
if(typeof(tp_inst._defaults.controlType) === 'string'){
213+
if(tp_inst._defaults.controlType == 'slider' && $.fn.slider === undefined){
214+
tp_inst._defaults.controlType = 'select';
215+
}
216+
tp_inst.control = tp_inst._controls[tp_inst._defaults.controlType];
217+
}
218+
// controlType is an object and must implement create, options, value methods
219+
else{
220+
tp_inst.control = tp_inst._defaults.controlType;
214221
}
215222

216223
if (tp_inst._defaults.timezoneList === null) {
@@ -226,7 +233,6 @@
226233
tp_inst._defaults.timezoneList = timezoneList;
227234
}
228235

229-
tp_inst.control = tp_inst._controls[tp_inst._defaults.controlType];
230236
tp_inst.timezone = tp_inst._defaults.timezone;
231237
tp_inst.hour = tp_inst._defaults.hour;
232238
tp_inst.minute = tp_inst._defaults.minute;
@@ -907,6 +913,7 @@
907913
return $t.data(opts);
908914
o[opts] = val;
909915
}
916+
else o = opts;
910917
return tp_inst.control.create(tp_inst, obj, $t.data('unit'), $t.val(), o.min || $t.data('min'), o.max || $t.data('max'), o.step || $t.data('step'));
911918
},
912919
value: function(tp_inst, obj, val){

0 commit comments

Comments
 (0)