Skip to content
Snippets Groups Projects
Commit e4e94698 authored by Mathias Chouet's avatar Mathias Chouet
Browse files

Fix bug in fieldsets refresh after compute

parent e0fe53bf
No related branches found
No related tags found
No related merge requests found
...@@ -89,8 +89,8 @@ export class FormulaireFixedVar extends FormulaireDefinition { ...@@ -89,8 +89,8 @@ export class FormulaireFixedVar extends FormulaireDefinition {
protected compute() { protected compute() {
this.runNubCalc(this.currentNub); this.runNubCalc(this.currentNub);
this.refreshFieldsets(); // important: before reaffectResultComponents() or it will break results components localization
this.reaffectResultComponents(); this.reaffectResultComponents();
this.refreshFieldsets();
} }
protected reaffectResultComponents() { protected reaffectResultComponents() {
...@@ -118,6 +118,9 @@ export class FormulaireFixedVar extends FormulaireDefinition { ...@@ -118,6 +118,9 @@ export class FormulaireFixedVar extends FormulaireDefinition {
} }
} }
/**
* Forces all fieldsets to update all their fields
*/
protected refreshFieldsets() { protected refreshFieldsets() {
for (const fs of this.allFieldsets) { for (const fs of this.allFieldsets) {
fs.updateFields(); fs.updateFields();
...@@ -132,9 +135,7 @@ export class FormulaireFixedVar extends FormulaireDefinition { ...@@ -132,9 +135,7 @@ export class FormulaireFixedVar extends FormulaireDefinition {
if (data.action === "propertyChange") { if (data.action === "propertyChange") {
this.reset(); this.reset();
// reflect changes in GUI (who knows ?), for ex. show / hide dependent fields // reflect changes in GUI (who knows ?), for ex. show / hide dependent fields
for (const fs of this.allFieldsets) { this.refreshFieldsets();
fs.updateFields();
}
} }
} }
} }
...@@ -87,10 +87,8 @@ export class FormulaireMacrorugoCompound extends FormulaireRepeatableFieldset { ...@@ -87,10 +87,8 @@ export class FormulaireMacrorugoCompound extends FormulaireRepeatableFieldset {
* Reflect inclinedApron property state in GUI * Reflect inclinedApron property state in GUI
*/ */
public updateApronState(inclined: MRCInclination) { public updateApronState(inclined: MRCInclination) {
for (const fs of this.allFieldsets) { // show / hide dependent fields (read from model)
// show / hide dependent fields (read from model) this.refreshFieldsets();
fs.updateFields();
}
// show / hide children list (GUI only) // show / hide children list (GUI only)
for (const elt of this.allFormElements) { for (const elt of this.allFormElements) {
if (elt instanceof FieldsetContainer) { if (elt instanceof FieldsetContainer) {
......
...@@ -18,6 +18,8 @@ export class FormulaireSection extends FormulaireFixedVar { ...@@ -18,6 +18,8 @@ export class FormulaireSection extends FormulaireFixedVar {
// show / hide dependent fields // show / hide dependent fields
fs.updateFields(); fs.updateFields();
} }
// show / hide dependent fields
this.refreshFieldsets();
// empty fields ? only those belonging to the specific section type // empty fields ? only those belonging to the specific section type
if (ServiceFactory.instance.applicationSetupService.enableEmptyFieldsOnFormInit) { if (ServiceFactory.instance.applicationSetupService.enableEmptyFieldsOnFormInit) {
// "LargeurBerge" is hackily used as LargeurFond in Rectangular and Trapez sections, omit it here // "LargeurBerge" is hackily used as LargeurFond in Rectangular and Trapez sections, omit it here
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment