# UI Control - Back to last tab

**URL:** <https://discourse.nodered.org/t/ui-control-back-to-last-tab/30266>\
**Category:** Dashboard\
**Created:** [17 July 2020 15:23 UTC](https://discourse.nodered.org/t/ui-control-back-to-last-tab/30266 "2020-07-17T15:23:39Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![nksky](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nksky/32/9173_2.png) [@nksky](https://discourse.nodered.org/u/nksky)\
**Post date:** [17 July 2020 15:23 UTC](https://discourse.nodered.org/t/ui-control-back-to-last-tab/30266/1 "2020-07-17T15:23:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [17 July 2020 15:36 UTC](https://discourse.nodered.org/t/ui-control-back-to-last-tab/30266/2 "2020-07-17T15:36:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nksky](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nksky/32/9173_2.png) [@nksky](https://discourse.nodered.org/u/nksky)\
**Post date:** [17 July 2020 15:47 UTC](https://discourse.nodered.org/t/ui-control-back-to-last-tab/30266/3 "2020-07-17T15:47:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [17 July 2020 16:04 UTC](https://discourse.nodered.org/t/ui-control-back-to-last-tab/30266/4 "2020-07-17T16:04:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Christian-Me](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/christian-me/32/10774_2.png) [@Christian-Me](https://discourse.nodered.org/u/Christian-Me)\
**Post date:** [17 July 2020 18:14 UTC](https://discourse.nodered.org/t/ui-control-back-to-last-tab/30266/5 "2020-07-17T18:14:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nksky](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nksky/32/9173_2.png) [@nksky](https://discourse.nodered.org/u/nksky)\
**Post date:** [17 July 2020 21:38 UTC](https://discourse.nodered.org/t/ui-control-back-to-last-tab/30266/6 "2020-07-17T21:38:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nksky](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nksky/32/9173_2.png) [@nksky](https://discourse.nodered.org/u/nksky)\
**Post date:** [18 July 2020 22:48 UTC](https://discourse.nodered.org/t/ui-control-back-to-last-tab/30266/7 "2020-07-18T22:48:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Christian-Me](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/christian-me/32/10774_2.png) [@Christian-Me](https://discourse.nodered.org/u/Christian-Me)\
**Post date:** [19 July 2020 00:30 UTC](https://discourse.nodered.org/t/ui-control-back-to-last-tab/30266/8 "2020-07-19T00:30:41Z")

</div>

Great to hear 👍

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [2 August 2020 00:30 UTC](https://discourse.nodered.org/t/ui-control-back-to-last-tab/30266/9 "2020-08-02T00:30:42Z")

</div>

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