formula: fix init when formula stirngs are empty and make updateValue method more robust

This commit is contained in:
jean-emmanuel 2017-08-25 22:18:57 +02:00
parent 6659a0a08d
commit 8523c11273
2 changed files with 19 additions and 4 deletions

View file

@ -117,14 +117,25 @@ module.exports = class Formula extends _widgets_base {
updateValue(e){
var variables = {},
id
id, n = 0
for (let id of this.linkedWidgets) {
if (id !== undefined) {
variables['_'+id] = widgetManager.getWidgetById(id)[0].getValue()
let widgets = widgetManager.getWidgetById(id)
for (let w of widgets) {
if (w.getValue) {
variables['_'+id] = w.getValue()
n++
break
}
}
}
}
if (!this.linkedWidgets.length || n < this.linkedWidgets.length) return
if (this.getProp('condition').length) {
try {