Uib update node

I am reading HTML and script tagged code from a text file as a single string using the file-read node and sending that to a uib_update node and then to the uibuilder node.

The HTML elements are updating but the code isn't displaying. However, if I take the same text file and paste it directly into the uibuilder node's index.html file, after the #more tag, the charts display perfectly.

I don't understand why the update node won't work for this.

Here is my test flow and text file.
myscript.txt (26.1 KB)
uib_update.json (3.6 KB)

I would like to be able to add charts to a page dynamically.

Thanks,
Dave

Hi Dave,

Code is treated differently by the browser due to security concerns. So with UIBUILDER, sending code to the browser needs to be done separately.

You have a number of ways to load and execute code however. And worth mentioning that the upcoming v7 release has some new features in this area that should make things simpler again.

For now though, if you check the documentation on the low-code features:

You will see that you could load javascript direct from a file if you wanted to. Do check out some of the limitations and warnings on the above page though as these can catch you out if not careful, especially some timing edge-cases. These aren't really UIBUILDER issues but arise from the way that browsers and HTML work.

In particular, check out the details for the load method:

It lets you either load JS direct from a resource file or pass it as a text string from Node-RED.

Okay, thank you for the help @TotallyInformation , much appreciated. Looking forward to V7 as well.

1 Like