Refresh tab/page after using another tab

I move the working window to tabB, I change some global variables there, and then I go back to the main tabA, but the strings of the global variables are the old ones.

How can I trigger tabA update when I go back from tabB?


Likely you need to use the UI control node to detect tab change & then update the items.

I think this might be a solution.
In tabB changes a "global.varname".
The user press a button to go back from tabB to tabA.
There is an inject node that every 0.3 sec sends a value msg; after that there is a node that let go the msg only if the variable in global has a new value; if yes the next node is reached and it updates the widget.

What is wrong with Steve's solution?

I admit: I haven't understood it Steve's reply :pensive:

The only thing I got is to work with changements; is what I proposed the same?

Did you look at the ui-control node? That can give you a message every time a browser changes the viewed tab. You can use that to detect when tab B is opened so that you can update the view.

Possibly better, of course, would be to update the fields on the view when you change the global variable so that it would be automatically updated. This problem is one of the reasons I avoid global and flow variables except in a small number of situations. If you update the fields when the tab is not visible then it still updates the data so that it will be correct when the tab is opened.

Sorry for the long delay, but I had a bug in my JSON setup file.

I solved in this way:

0- Repeting injection
This node was already present. From this to #1
1- Function node:

var vrvstatus = typeof(global.get("vrvstatus")) == 'undefined' ? {} : global.get("vrvstatus");
var recipeID = 1;

if (vrvstatus.status.hasOwnProperty("status") ){
    recipeID = global.get("vrvstatus.status.recipeID");

msg = { payload: recipeID };

return msg;

2 - rbe (block until msg.payload change)

3 - the widget/label

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