Commit 30d2bac4 authored by Xiaohe Cao's avatar Xiaohe Cao Committed by Romain Courteaud

[erp5_web_renderjs_ui] Listen to listfield change

parent 72fd26d6
......@@ -31,6 +31,7 @@
.declareAcquiredMethod("translateHtml", "translateHtml")
.declareAcquiredMethod("notifyValid", "notifyValid")
.declareAcquiredMethod("notifyInvalid", "notifyInvalid")
.declareAcquiredMethod("notifyChange", "notifyChange")
.declareMethod('getTextContent', function () {
var select = this.element.querySelector('select');
return select.options[select.selectedIndex || 0].text;
......@@ -102,6 +103,29 @@
result[input.getAttribute('name')] = input.options[input.selectedIndex].value;
return result;
})
.declareService(function () {
////////////////////////////////////
// Check field validity when the value changes
////////////////////////////////////
var field_gadget = this;
function notifyChange() {
return RSVP.all([
field_gadget.checkValidity(),
field_gadget.notifyChange()
]);
}
// Listen to input change
return loopEventListener(
field_gadget.element.querySelector('select'),
'change',
false,
notifyChange
);
})
.declareService(function () {
////////////////////////////////////
// Inform when the field input is invalid
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>949.15483.53582.15957</string> </value>
<value> <string>952.64761.25287.18397</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1455899167.96</float>
<float>1470231990.11</float>
<string>UTC</string>
</tuple>
</state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment