text x-clear button and new $tpl
property in inputs, need tests
This commit is contained in:
src
editable-form
img
inputs-ext
address
inputs
@ -14,44 +14,41 @@ Automatically shown in inline mode.
|
||||
|
||||
$.extend(DateField.prototype, {
|
||||
render: function () {
|
||||
this.$input = $(this.options.tpl);
|
||||
this.$field = this.$input.find('input');
|
||||
this.$tpl = $(this.options.tpl);
|
||||
this.$input = this.$tpl.find('input');
|
||||
|
||||
if(this.options.inputclass) {
|
||||
this.$field.addClass(this.options.inputclass);
|
||||
this.$input.addClass(this.options.inputclass);
|
||||
}
|
||||
|
||||
if (this.options.placeholder) {
|
||||
this.$field.attr('placeholder', this.options.placeholder);
|
||||
this.$input.attr('placeholder', this.options.placeholder);
|
||||
}
|
||||
|
||||
this.$input.datepicker(this.options.datepicker);
|
||||
this.$tpl.datepicker(this.options.datepicker);
|
||||
|
||||
//need to disable original event handlers
|
||||
this.$field.off('focus keydown');
|
||||
this.$input.off('focus keydown');
|
||||
|
||||
//update value of datepicker
|
||||
this.$field.keyup($.proxy(function(){
|
||||
this.$input.removeData('date');
|
||||
this.$input.datepicker('update');
|
||||
this.$input.keyup($.proxy(function(){
|
||||
this.$tpl.removeData('date');
|
||||
this.$tpl.datepicker('update');
|
||||
}, this));
|
||||
|
||||
},
|
||||
|
||||
value2input: function(value) {
|
||||
this.$field.val(value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '');
|
||||
this.$input.datepicker('update');
|
||||
this.$input.val(value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '');
|
||||
this.$tpl.datepicker('update');
|
||||
},
|
||||
|
||||
input2value: function() {
|
||||
return this.html2value(this.$field.val());
|
||||
return this.html2value(this.$input.val());
|
||||
},
|
||||
|
||||
activate: function() {
|
||||
if(this.$field.is(':visible')) {
|
||||
this.$field.focus();
|
||||
$.fn.editableutils.setCursorPosition(this.$field.get(0), this.$field.val().length);
|
||||
}
|
||||
$.fn.editabletypes.text.prototype.activate.call(this);
|
||||
},
|
||||
|
||||
autosubmit: function() {
|
||||
@ -64,12 +61,12 @@ Automatically shown in inline mode.
|
||||
@property tpl
|
||||
@default
|
||||
**/
|
||||
tpl:'<div class="input-append date"><input class="input-small" type="text"/><span class="add-on"><i class="icon-th"></i></span></div>',
|
||||
tpl:'<div class="input-append date"><input type="text"/><span class="add-on"><i class="icon-th"></i></span></div>',
|
||||
/**
|
||||
@property inputclass
|
||||
@default ''
|
||||
@default 'input-small'
|
||||
**/
|
||||
inputclass: '',
|
||||
inputclass: 'input-small',
|
||||
|
||||
/* datepicker config */
|
||||
datepicker: {
|
||||
|
Reference in New Issue
Block a user