Add enable and disable feature by wallenium. Feature not yet stable but doesnt impact rest of plugin
This commit is contained in:
parent
5d05d23fa6
commit
999803035f
33
jquery-ui-timepicker-addon.js
vendored
33
jquery-ui-timepicker-addon.js
vendored
|
@ -65,7 +65,8 @@ function Timepicker() {
|
||||||
secondGrid: 0,
|
secondGrid: 0,
|
||||||
alwaysSetTime: true,
|
alwaysSetTime: true,
|
||||||
separator: ' ',
|
separator: ' ',
|
||||||
altFieldTimeOnly: true
|
altFieldTimeOnly: true,
|
||||||
|
showTimepicker: true
|
||||||
};
|
};
|
||||||
$.extend(this._defaults, this.regional['']);
|
$.extend(this._defaults, this.regional['']);
|
||||||
}
|
}
|
||||||
|
@ -253,7 +254,8 @@ $.extend(Timepicker.prototype, {
|
||||||
dp_id = this.inst.id.toString().replace(/([^A-Za-z0-9_])/g, '');
|
dp_id = this.inst.id.toString().replace(/([^A-Za-z0-9_])/g, '');
|
||||||
|
|
||||||
// Prevent displaying twice
|
// Prevent displaying twice
|
||||||
if ($dp.find("div#ui-timepicker-div-"+ dp_id).length === 0) {
|
//if ($dp.find("div#ui-timepicker-div-"+ dp_id).length === 0) {
|
||||||
|
if ($dp.find("div#ui-timepicker-div-"+ dp_id).length === 0 && o.showTimepicker) {
|
||||||
var noDisplay = ' style="display:none;"',
|
var noDisplay = ' style="display:none;"',
|
||||||
html = '<div class="ui-timepicker-div" id="ui-timepicker-div-' + dp_id + '"><dl>' +
|
html = '<div class="ui-timepicker-div" id="ui-timepicker-div-' + dp_id + '"><dl>' +
|
||||||
'<dt class="ui_tpicker_time_label" id="ui_tpicker_time_label_' + dp_id + '"' +
|
'<dt class="ui_tpicker_time_label" id="ui_tpicker_time_label_' + dp_id + '"' +
|
||||||
|
@ -633,7 +635,9 @@ $.extend(Timepicker.prototype, {
|
||||||
|
|
||||||
this.formattedDateTime = formattedDateTime;
|
this.formattedDateTime = formattedDateTime;
|
||||||
|
|
||||||
if (this.$altInput && this._defaults.altFieldTimeOnly === true) {
|
if(!this._defaults.showTimepicker) {
|
||||||
|
this.$input.val(this.formattedDate);
|
||||||
|
} else if (this.$altInput && this._defaults.altFieldTimeOnly === true) {
|
||||||
this.$altInput.val(this.formattedTime);
|
this.$altInput.val(this.formattedTime);
|
||||||
this.$input.val(this.formattedDate);
|
this.$input.val(this.formattedDate);
|
||||||
} else if(this.$altInput) {
|
} else if(this.$altInput) {
|
||||||
|
@ -784,6 +788,29 @@ $.datepicker._gotoToday = function(id) {
|
||||||
this._setTime(this._getInst($(id)[0]), new Date());
|
this._setTime(this._getInst($(id)[0]), new Date());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//#######################################################################################
|
||||||
|
// Disable & enable the Time in the datetimepicker
|
||||||
|
//#######################################################################################
|
||||||
|
$.datepicker._disableTimepickerDatepicker = function(target, date, withDate) {
|
||||||
|
var inst = this._getInst(target),
|
||||||
|
tp_inst = this._get(inst, 'timepicker');
|
||||||
|
if (tp_inst) {
|
||||||
|
tp_inst._defaults.showTimepicker = false;
|
||||||
|
tp_inst._onTimeChange();
|
||||||
|
tp_inst._updateDateTime(inst);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$.datepicker._enableTimepickerDatepicker = function(target, date, withDate) {
|
||||||
|
var inst = this._getInst(target),
|
||||||
|
tp_inst = this._get(inst, 'timepicker');
|
||||||
|
if (tp_inst) {
|
||||||
|
tp_inst._defaults.showTimepicker = true;
|
||||||
|
tp_inst._onTimeChange();
|
||||||
|
tp_inst._updateDateTime(inst);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
//#######################################################################################
|
//#######################################################################################
|
||||||
// Create our own set time function
|
// Create our own set time function
|
||||||
//#######################################################################################
|
//#######################################################################################
|
||||||
|
|
Loading…
Reference in a new issue