UI Control - Back to last tab

Hi,

Setting up a menu system on Node-Red dashboard. On each screen I have 2 buttons, "Main Menu" and "Back", what do I need send to go back to the last tab that was used, I have tried a few things but to no avail.

Thanks in advance.

Looking in the Help section it says...

Sending a blank tab name "" will refresh the current page.
You can also send "+1" for next tab and "-1" for previous tab.

Thanks Dave,

But "-1" only brings you to the previous tab thats listed on the UI control. I would like to go back the previous page/tab I was on.

Eg. Main Page - Press Network Button - Network Page- Wifi or Ethernet (Choice) Select Wifi. So at this point two buttons "back" or "main menu". I want the back button to go back to the choice page. If I put in "-1" it will bring me to the tab previously listed. In this case its a video tab.

Make sense?? Or can it be done?

Thanks

well if it's always back to the same place (home) then you can jump to that tab direct via ui_control (maybe tab 0 ) - if back can vary then you will have to save it - and then pass that to ui_control

You can keep track of all (or some) tab ids you visited in global/fow context (push the id onto an arrax) A (back) button trigger a function node that gets the last id (take two of the stack because the top one is the current id) and jump to this position. With array push/pop you can even have a history. If you push the top one to a forward stack before jumping back you can even implement a forward button.
If you place a forward backward button onto the status bar you don’t have to place ui-buttons on every tab (but I don’t have a clue how to do that - think a template node can do the trick.

Thanks everyone for the replies, Christians way looks best, a little complicated but I'll give it a try and see how it goes. Will update soon.

1 Like

Thanks, This worked a treat, took a little time setup, not as easy as typing "+/-1" etc, but works a charm. Thanks.

Great to hear :+1:

Perhaps you like to share your solution. I’m interested.

2 Likes

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