Commit 6ad8df10 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Do not rewrite the header when a field changes

Rewritting the header means removing the submit button from the DOM, and losing the submit event.

Example:
* modify an input value
* click (with the mouse/touch) the Save button
* browser with submit 'change' event on the input and 'click' event on the button
* if 'change' event is triggered before, it will lead to the header rewrite. The 'click' event on the button will lead to a form 'submit' event, which will not be catched by the gadget, as the form is already outside the DOM
parent 8f5497d4
......@@ -202,7 +202,14 @@
.declareMethod(\'notifyChange\', function () {\n
if (!this.stats.modified) {\n
this.stats.modified = true;\n
return this.render(this.stats.options);\n
// Directly modify the previous calculated header\n
// in order not to remove the submit input\n
// and still receive \'submit\' event\n
var class_list = this.props.right_link.querySelector(\'button\').classList;\n
if (class_list.contains(\'ui-icon-check\')) {\n
class_list.remove(\'ui-icon-check\');\n
class_list.add(\'ui-icon-warning\');\n
}\n
}\n
})\n
.declareMethod(\'notifySubmitting\', function () {\n
......@@ -580,7 +587,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>948.17414.26904.28091</string> </value>
<value> <string>948.20235.19332.48128</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -598,7 +605,7 @@
</tuple>
<state>
<tuple>
<float>1452006752.82</float>
<float>1452175785.28</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