# JSON function to hide group and tab at the same time

**URL:** https://discourse.nodered.org/t/json-function-to-hide-group-and-tab-at-the-same-time/42451
**Category:** Dashboard
**Created:** [11 March 2021 08:12 UTC](https://discourse.nodered.org/t/json-function-to-hide-group-and-tab-at-the-same-time/42451 "2021-03-11T08:12:40Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![sfedo](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@sfedo](https://discourse.nodered.org/u/sfedo)
#### Post date: [11 March 2021 08:12 UTC](https://discourse.nodered.org/t/json-function-to-hide-group-and-tab-at-the-same-time/42451/1 "2021-03-11T08:12:40Z")

</div>

Hello everyone,

I would like to hide some tabs and groups and show some other only with one function node. What is the right format to do so. In the description the both functions are separated. Is it possible to combine them somehow?

I was trying this:

```auto
if(msg.tab==3){
    msg.payload=
    {"tabs":
    {"hide":
    ["Home_1","Strommessung","Mobile","Home_2"],
    "show":
    ["Home_mobile","Strom_mobile"]}},
    {"group":
    {"hide":["Home_mobile_Start"],
    "show":["Home_mobile_Start_mobile"],
   "focus":true}}
}
return msg;

```

but it doestn work. It only shows and hide the tabs, but not the groups. What am I missing?

---

<div class="post-metadata">

### Author: ![Andrei](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andrei/32/10446_2.png) [@Andrei](https://discourse.nodered.org/u/Andrei)
#### Post date: [11 March 2021 14:18 UTC](https://discourse.nodered.org/t/json-function-to-hide-group-and-tab-at-the-same-time/42451/2 "2021-03-11T14:18:52Z")

</div>

Good question indeed.

Your `msg.payload` is not even a valid object, so it seems normal that your code will not work.

Can´t you possibly issue two different payloads for each purpose ? One for managing groups and then another one to manage tabs ?

PS: Perhaps you want to test with this modified object ? I did not test as it woudl take some time to build all those groups and tabs.

```auto
{
    "tabs": {
        "hide": [
            "Home_1",
            "Strommessung",
            "Mobile",
            "Home_2"
        ],
        "show": [
            "Home_mobile",
            "Strom_mobile"
        ]
    },
    "group": {
        "hide": [
            "Home_mobile_Start"
        ],
        "show": [
            "Home_mobile_Start_mobile"
        ]
    }
}

```

---

<div class="post-metadata">

### Author: ![sfedo](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@sfedo](https://discourse.nodered.org/u/sfedo)
#### Post date: [12 March 2021 08:57 UTC](https://discourse.nodered.org/t/json-function-to-hide-group-and-tab-at-the-same-time/42451/3 "2021-03-12T08:57:11Z")

</div>

It seems to work! Thank you very much!

---

<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: [26 March 2021 08:58 UTC](https://discourse.nodered.org/t/json-function-to-hide-group-and-tab-at-the-same-time/42451/4 "2021-03-26T08:58:04Z")

</div>

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