clear button in dateui

This commit is contained in:
vitalets
2012-11-26 15:32:13 +04:00
parent 2438ea8da1
commit bd64464a5d
4 changed files with 68 additions and 5 deletions
CHANGELOG.txt
src
editable-form
inputs
dateui
test/unit

@ -56,4 +56,5 @@
.editable-clear {
float: right;
font-size: 0.9em;
text-decoration: none;
}

@ -52,6 +52,14 @@ $(function(){
render: function () {
DateUI.superclass.render.call(this);
this.$input.datepicker(this.options.datepicker);
if(this.options.clear) {
this.$clear = $('<a href="#">').addClass('editable-clear').html(this.options.clear).click($.proxy(function(e){
e.preventDefault();
e.stopPropagation();
this.clear();
}, this));
}
},
value2html: function(value, element) {
@ -100,7 +108,11 @@ $(function(){
},
activate: function() {
}
},
clear: function() {
this.$input.datepicker('setDate', null);
}
});
@ -150,7 +162,16 @@ $(function(){
firstDay: 0,
changeYear: true,
changeMonth: true
}
},
/**
Text shown as clear date button.
If <code>false</code> clear button will not be rendered.
@property clear
@type boolean|string
@default 'x clear'
**/
clear: '&times; clear'
});
$.fn.editableform.types.dateui = DateUI;