Add log to Dashboard without an array

Hello, I there are many contributors that already have discussed this problem.

https://flows.nodered.org/flow/6dc1a137075ad93cd7c00224681afeda

However, I have a question about the presented approach.
In general, variables are stored in context or flow. An array is built and than displayed using Angular.js.

Is there a way to dynamic add msg.payload without store it in the context.

For instance, using jQuery, is it possible to append:

$( "body" ).append('<div>log line</div>');

Can I do the same using Angular or it is only possible with jQuery?

Yes. In fact, there might even be one of my old flows in the flows library that works like that. I remember a long time ago building a simple log output to a web page. Don't remember all the details though and it is possible I didn't use Dashboard. However, the principle would be the same.

The concept is simple, you append to the DOM as you indicated. In fact, you can use Angular to assist by using a ui_template node, creating a loop in the code that is driven by a local variable. Then you send updates to that variable. Personally I find Angular a pain though which is one of the reasons why I don't do anything complex in Dashboard.

Of course, everything will be reset if someone reloads the Dashboard tab unless you also create a cache in node-red.

Thanks @TotallyInformation. That is exactly what I'm looking for. Can you give me an example on how to perform it? Your idea is indeed jQuery? I can also limit the log number by counting elements.

In theory, I know how to do it. Unfortunately, I'm not a javascript expert. I always spend a lot of time for simple tasks.

Have a look at:

and see if any of them come anywhere near what you are thinking of. They are a bit old but might still have some useful ideas.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.