From 5dbd77d10cbed5a984310947545f4aed4bbc0449 Mon Sep 17 00:00:00 2001 From: Nikhil Date: Wed, 18 Sep 2019 13:19:26 -0700 Subject: [PATCH] [Summary Widgets] Adding a new condition to a rule deletes the input value from previous ones #2411 (#2481) * [Summary Widgets] Adding a new condition to a rule deletes the input value from previous ones #2411 * Summary Widget Rule conditions not persisting numeric values #2491 --- src/plugins/summaryWidget/src/Condition.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/summaryWidget/src/Condition.js b/src/plugins/summaryWidget/src/Condition.js index 08d47f54a6..fc7cf77c47 100644 --- a/src/plugins/summaryWidget/src/Condition.js +++ b/src/plugins/summaryWidget/src/Condition.js @@ -180,7 +180,7 @@ define([ inputArea.html(''); this.valueInputs = []; - this.config.values = []; + this.config.values = this.config.values || []; if (evaluator.getInputCount(operation)) { inputCount = evaluator.getInputCount(operation); @@ -191,8 +191,10 @@ define([ newInput = $(''); emitChange = true; } else { - this.config.values[index] = inputType === 'number' ? 0 : ''; - newInput = $(' '); + const defaultValue = inputType === 'number' ? 0 : ''; + const value = this.config.values[index] || defaultValue; + this.config.values[index] = value; + newInput = $(''); } this.valueInputs.push(newInput.get(0));