add defaultValue option, related to

This commit is contained in:
vitalets
2013-08-05 23:01:24 +04:00
parent 0471b7b01b
commit 241a217ab9
4 changed files with 55 additions and 2 deletions

@ -102,7 +102,8 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
this.error(false);
this.input.$input.removeAttr('disabled');
this.$form.find('.editable-submit').removeAttr('disabled');
this.input.value2input(this.value);
var value = (this.value === null || this.value === undefined || this.value === '') ? this.options.defaultValue : this.value;
this.input.value2input(value);
//attach submit handler
this.$form.submit($.proxy(this.submit, this));
}
@ -477,6 +478,14 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
**/
value: null,
/**
Value that will be displayed in input if original field value is `null`.
@property defaultValue
@type string|object
@default null
**/
defaultValue: null,
/**
Strategy for sending data on server. Can be `auto|always|never`.
When 'auto' data will be sent on server **only if pk and url defined**, otherwise new value will be stored locally.