Hidden groups always visible when opening Dashboard in browser for the first time

I have several groups on my dashboard in one tab, some of which may or may not be visible depending on various parameters. This is possible via a function node and a payload like

payload={"group":{"show":["Group1"], "hide":["Group2","Group3"]}};

and works fine so far.

The problem: When I open the dashboard in a browser for the first time, all groups that should be invisible are visible. But the code works fine in my opinion, it seems that I am missing something.

Example: I open the dashboard on my computer in Firefox. All groups are visible, which is wrong. I create the correct state manually using an inject node. The dashboard in Firefox is then correct. Then I open the dashboard in another browser, e.g. Chrome, on the same computer. Again all groups are visible, which is wrong again. In Firefox on the same computer the dashboard is still correct.

How can I solve the problem so that the correct state is displayed every time I start Dashboard?

Use the ui_control node to create an event on connections and use that to send that same message as the inject

Thanks for the quick answer. But I am afraid my knowledge is not advanced enough to get your point. Could you please explain in detail (or post a rough flow as an example) on what I should do? I saw that the ui_control node delivers 3 events when I open the dashboard (lost, connect, change), but I do not understand how I can take advantage of that. Should I wire another function node to the output of my already exiting ui_control node, check if incoming payload is "connect" and then use the same input to the ui_control node as the output of this function node which delivers this payload to another (new) ui_control node???

Yes, ui_control node set to "Connect event only" -> function node (or change node) to set msg.payload to the hide groups message as per your inject -> ui_control node (either a different one or loop back to same one... shouldn't matter.

Thanks, this works fine. One last question: I am sending my payload through a function node into the ui_control node. Then I will use - as you suggested - another function node to set the same payload to a new ui_control node. Problem: The first ui_control node does not forward the incoming payload to the output, so my following function node does not know anything about the desired visibility state. Hardcoding the visibility state in the function node is of course not possble. Any suggestion how to forward the visibility state of my first function node through the first ui_control node to the second function node? Thanks for your help! I really appreciate this!

split the wires and send it to both ?

Sorry for being so stupid, but I cannot figure out how I should wire everything together. Lets see what I have:

  • The function node determines visibility by checking some parameters, and puts it into the payload. The output is unknown. Groups could be visible or not.
  • The first ui_control gets the payload. It is configured as "Connect event only".
  • The change node gets - what? Obviously both the payload from the function node and the ui_control node. So this makes no sense to me as it fires "connect" into the second ui_control when accessing the dashboard which does nothing whereas it should fire the payload from the function node into the second ui_control.

Sorry again for being that stupid, but at the moment I do not see the wood for the trees ...

Ah right ok - instead I would just use the function to store the visibility value into a flow context variable - then use the change node to set the payload from that variable. The top ui control node doesn't then need an input at all as it just provides the connect message.

OK, so this is now what I came up with:


Seems to work, although I did not understand what you mean by saying

The top ui control node doesn't then need an input at all as it just provides the connect message.

Which of the two ui_control nodes is "the top ui_control"? Thanks again for your patience!

the one that was above (on top) of the others in your first picture.

Ah I see, that makes perfectly sense. Thanks again for enlighten me!

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