setvalue updates input if form is open
This commit is contained in:
parent
e615a3d89a
commit
24cc4ad61f
@ -4,6 +4,7 @@ X-editable changelog
|
||||
|
||||
Version 1.4.0 wip
|
||||
----------------------------
|
||||
[enh] setValue method updates input if form is open (vitalets)
|
||||
[enh] select: chnage source via option method, see #61 (vitalets)
|
||||
[bug] select: source loaded twice if sourceCache = false (vitalets)
|
||||
[enh] added `destroy` method, see #61 (vitalets)
|
||||
|
@ -323,6 +323,11 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
|
||||
} else {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
//if form is visible, update input
|
||||
if(this.$form && this.$form.is(':visible')) {
|
||||
this.input.value2input(this.value);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -361,10 +361,18 @@ $(function () {
|
||||
equal(e.data('editable').value, 1, 'value correct');
|
||||
equal(e.text(), groups[1], 'text shown correctly');
|
||||
|
||||
//open editable to check update of input
|
||||
e.click();
|
||||
var p = tip(e);
|
||||
|
||||
equal(p.find('select').find('option').length, size, 'options loaded');
|
||||
equal(p.find('select').val(), e.data('editable').value, 'selected value correct');
|
||||
|
||||
e.editable('setValue', 2);
|
||||
|
||||
equal(e.data('editable').value, 2, 'new value correct');
|
||||
equal(e.text(), groups[2], 'new text shown correctly');
|
||||
equal(p.find('select').val(), e.data('editable').value, 'new selected value correct');
|
||||
});
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user