Hi,
I'm trying to use the newly added function (since dashboard version 2.20.0) to expand/collapse groups via open/close command with the similar syntax as used for show/hide.
(according to this post: https://discourse.nodered.org/t/collapse-group-using-ui-control/21997/5)
unfortunately it doesnt work for me.
hide/show is working with the JSON expression:
{"group":{"hide":["GER_ECH_E4-1.1"]}}
but open/close isnt working with:
{"group":{"close":["GER_ECH_E4-1.1"]}}
Any ideas? The help of the ui_control node doesnt mention the open/close feature, yet.
Following you can find a flow with an comparison of both (hide/show vs open/close)
[
{
"id": "4aadf706.9cd248",
"type": "function",
"z": "d77ce098.e6c78",
"name": "open / close",
"func": "var load = msg.payload\nvar topic = msg.topic\n\n \nif (load === 0){\nmsg =\n {\n payload: { \n \"group\": {\n \"close\": [\n \"GER_ECH_E4-1.1\" \n ]\n }}}\n}\nif (load === 1){\n msg =\n {\n payload: { \n \"group\": {\n \"open\": [\n \"GER_ECH_E4-1.1\"\n ]\n }}} \n} \n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 2810,
"y": 1620,
"wires": [
[
"cf96440f.77d3f8"
]
]
},
{
"id": "cf96440f.77d3f8",
"type": "ui_ui_control",
"z": "d77ce098.e6c78",
"name": "",
"events": "all",
"x": 3200,
"y": 1640,
"wires": [
[]
]
},
{
"id": "3ad49f49.3bef6",
"type": "inject",
"z": "d77ce098.e6c78",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "1",
"payloadType": "num",
"x": 2590,
"y": 1580,
"wires": [
[
"4aadf706.9cd248"
]
]
},
{
"id": "15821998.6f3486",
"type": "inject",
"z": "d77ce098.e6c78",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "0",
"payloadType": "num",
"x": 2590,
"y": 1620,
"wires": [
[
"4aadf706.9cd248"
]
]
},
{
"id": "4f957eae.6cdd2",
"type": "function",
"z": "d77ce098.e6c78",
"name": "show / hide",
"func": "var load = msg.payload\nvar topic = msg.topic\n\n \nif (load === 0){\nmsg =\n {\n payload: { \n \"group\": {\n \"hide\": [\n \"GER_ECH_E4-1.1\" \n ]\n }}}\n}\nif (load === 1){\n msg =\n {\n payload: { \n \"group\": {\n \"show\": [\n \"GER_ECH_E4-1.1\"\n ]\n }}} \n} \n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 2810,
"y": 1680,
"wires": [
[
"cf96440f.77d3f8"
]
]
},
{
"id": "be94e4da.4d6ca8",
"type": "inject",
"z": "d77ce098.e6c78",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "1",
"payloadType": "num",
"x": 2590,
"y": 1680,
"wires": [
[
"4f957eae.6cdd2"
]
]
},
{
"id": "48d0e960.f6d2c8",
"type": "inject",
"z": "d77ce098.e6c78",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "0",
"payloadType": "num",
"x": 2590,
"y": 1720,
"wires": [
[
"4f957eae.6cdd2"
]
]
}
]
Node-Red V1.2.2
Dashboard V2.24.0
Thanks!
Marco