Date picker separated: reset time when reset date

This commit is contained in:
chris committed 2013-01-09 21:17:50 +08:00
1 parent 1d405c3ffe
commit b49251afee
4 files changed
+36 -7

No files matched your search

+12 -4
View File
@@ -46,8 +46,9 @@
this.pickDate = options.pickDate;
this.pickTime = options.pickTime;
this.isInput = this.$element.is('input');
// this.component = this.$element.is('.input-prepend') ? this.$element.find('.add-on') : false;
this.component = this.$element.is('.input-append') ? this.$element.find('.add-on') : false;
// this.component = this.$element.is('.input-prepend') ? this.$element.find('.iconbtn') : false;
this.component = this.$element.is('.input-append') ? this.$element.find('.iconbtn') : false;
this.clearDate = this.$element.is('.input-append') ? this.$element.find('.clearDate') : false;
this.format = options.format;
if (!this.format) {
if (this.isInput) this.format = this.$element.data('format');
@@ -215,7 +216,7 @@
input = this.$element.find('input');
this.widget.css({
top: offset.top + this.height,
left: offset.left - input.outerWidth(),
left: offset.left - input.outerWidth() - this.width,
});
},
@@ -694,6 +695,12 @@
this._resetMaskPos(input);
},
clear: function(e) {
if (this.isInput) this.$element.val(null);
else this.$element.find('input').val(null);
this.notifyChange();
},
showMode: function(dir) {
if (dir) {
this.viewMode = Math.max(this.minViewMode, Math.min(
@@ -833,6 +840,7 @@
// this handles time picker clicks
this.widget.on('click', '[data-action]', $.proxy(this.doAction, this));
this.widget.on('mousedown', $.proxy(this.stopEvent, this));
this.clearDate.on('click', $.proxy(this.clear, this));
if (this.pickDate && this.pickTime) {
this.widget.on('click.togglePicker', '.accordion-toggle', function(e) {
e.stopPropagation();
@@ -847,7 +855,7 @@
expanded.collapse('hide');
closed.collapse('show')
$this.find('i').toggleClass(self.timeIcon + ' ' + self.dateIcon);
self.$element.find('.add-on i').toggleClass(self.timeIcon + ' ' + self.dateIcon);
self.$element.find('.iconbtn i').toggleClass(self.timeIcon + ' ' + self.dateIcon);
}
});
}