I noticed that enabling/disabling template nodes becomes not usable if template gets some input from msg.payload
For example the following flow, uses a template to generate a list of text inputs starting from an array of labels in msg.payload.
[{"id":"51c73d95.d5dee4","type":"inject","z":"4f276a09.ba5e54","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":320,"y":180,"wires":[["7d6301b7.dd766"]]},{"id":"4ea090a1.32f02","type":"inject","z":"4f276a09.ba5e54","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":310,"y":280,"wires":[["40764ebe.e362"]]},{"id":"40764ebe.e362","type":"function","z":"4f276a09.ba5e54","name":"Set enabled property","func":"msg = {enabled:msg.payload};\nreturn msg;","outputs":1,"noerr":0,"x":520,"y":300,"wires":[["72f913cd.fd7c8c"]]},{"id":"d4372db5.efb27","type":"inject","z":"4f276a09.ba5e54","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":310,"y":320,"wires":[["40764ebe.e362"]]},{"id":"72f913cd.fd7c8c","type":"ui_template","z":"4f276a09.ba5e54","group":"a2a7a98e.efd6b8","name":"","order":4,"width":"6","height":"9","format":"<div ng-repeat=\"row in msg.payload\">\n <label>{{row}}</label>\n <input style=\"width:100%;\" ng-model-options=\"{ debounce: 200 }\" ng-model=\"i[$index]\" ng-change=\"out.payload = {val : i[$index], index : $index}; send(out)\"><br>\n</div>\n","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":720,"y":180,"wires":[[]]},{"id":"7d6301b7.dd766","type":"function","z":"4f276a09.ba5e54","name":"create label array","func":"msg.payload = [\"Label1\",\"Label2\",\"Label3\"];\nreturn msg;","outputs":1,"noerr":0,"x":510,"y":180,"wires":[["72f913cd.fd7c8c"]]},{"id":"a2a7a98e.efd6b8","type":"ui_group","z":"","name":"Template group","tab":"5b337e3b.68826","order":2,"disp":true,"width":"6","collapse":false},{"id":"5b337e3b.68826","type":"ui_tab","z":"","name":"Home","icon":"home","order":1}]
When you try to dynamically enable/disable using msg.enabled = true/false, the content disappears.
I think it is related to the following quote of the dashboard documentation:
Any widget can be disabled by passing in a
msg.enabled
property set tofalse;
. Note: this doesn't stop the widget receiving messages but does stop inputs being active and does re-style the widget.
The re-style causes the template to evaluate again the message.payload, which is not present in the enable message.
Is there any way to overcome this behavior?