datefield ready, need tests
This commit is contained in:
@@ -146,7 +146,34 @@
|
||||
/*jslint eqeq: false*/
|
||||
|
||||
return result;
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
Returns input by options: type, mode.
|
||||
*/
|
||||
createInput: function(options) {
|
||||
var TypeConstructor, typeOptions, input,
|
||||
type = options.type;
|
||||
|
||||
if(type === 'date' && options.mode === 'inline') {
|
||||
if($.fn.editabletypes.datefield) {
|
||||
type = 'datefield';
|
||||
} else if($.fn.editabletypes.dateuifield) {
|
||||
type = 'dateuifield';
|
||||
}
|
||||
}
|
||||
|
||||
//create input of specified type. Input will be used for converting value, not in form
|
||||
if(typeof $.fn.editabletypes[type] === 'function') {
|
||||
TypeConstructor = $.fn.editabletypes[type];
|
||||
typeOptions = this.sliceObj(options, this.objectKeys(TypeConstructor.defaults));
|
||||
input = new TypeConstructor(typeOptions);
|
||||
return input;
|
||||
} else {
|
||||
$.error('Unknown type: '+ type);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
}(window.jQuery));
|
||||
}(window.jQuery));
|
||||
|
@@ -21,18 +21,13 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
|
||||
EditableForm.prototype = {
|
||||
constructor: EditableForm,
|
||||
initInput: function() { //called once
|
||||
var TypeConstructor, typeOptions;
|
||||
|
||||
//create input of specified type
|
||||
if(typeof $.fn.editabletypes[this.options.type] === 'function') {
|
||||
TypeConstructor = $.fn.editabletypes[this.options.type];
|
||||
typeOptions = $.fn.editableutils.sliceObj(this.options, $.fn.editableutils.objectKeys(TypeConstructor.defaults));
|
||||
this.input = new TypeConstructor(typeOptions);
|
||||
} else {
|
||||
$.error('Unknown type: '+ this.options.type);
|
||||
this.input = $.fn.editableutils.createInput(this.options);
|
||||
if(!this.input) {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//set initial value
|
||||
this.value = this.input.str2value(this.options.value);
|
||||
},
|
||||
initTemplate: function() {
|
||||
|
Reference in New Issue
Block a user