From 5b0427fe0c44d5c3c9373347e0f29e16bf51c000 Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 22 Jun 2022 14:25:31 -0600 Subject: [PATCH] Hopefully fix boolean reflected attributes not properly getting set The previous way worked eventually, but attributes did not get immediately synced to properties --- api/js/etemplate/Et2Widget/Et2Widget.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/api/js/etemplate/Et2Widget/Et2Widget.ts b/api/js/etemplate/Et2Widget/Et2Widget.ts index 0a1c01a417..c811c7e8d1 100644 --- a/api/js/etemplate/Et2Widget/Et2Widget.ts +++ b/api/js/etemplate/Et2Widget/Et2Widget.ts @@ -1416,17 +1416,15 @@ function transformAttributes(widget, mgr : et2_arrayMgr, attributes) if(widget.getAttributeNames().indexOf(attribute) >= 0 || property.reflect && attrValue) { // Set as attribute (reflected in DOM) - widget.setAttribute(attribute, attrValue); + widget.setAttribute(attribute, attrValue === true ? "" : attrValue); } - else if (attribute === 'options') + else if(attribute === 'options') { - console.trace('Ignored setting depricated "options" attribute for widget #'+widget.id, widget); - } - else - { - // Set as property, not attribute - widget[attribute] = attrValue; + console.trace('Ignored setting depricated "options" attribute for widget #' + widget.id, widget); + continue; } + // Set as property + widget[attribute] = attrValue; } if(widget_class.getPropertyOptions("value") && widget.set_value)