Dashboard 2 dropdown - inconsistent behavior on msg input

Hi

I am seeing an inconsistent behavior with Dashboard 2 ui-dropdown node.
This is being seen especially pass message when arrives as input is ticked on.

I am sending the msg.payload to dropdown node to pre-select one of the options.
I see that despite the debug pane showing that messages are correct - yet drop down doesnt reflect always the selected option. It shows nothing selected.

(My flows have 1 dropdown sending message to multiple other drop downs)

The moment I switch off the option to pass input message when arrives and change the flow to see that each drop down receives its own message and not from a previous drop down - it works.

I have tested few times - to be sure its not something in my flows.

Any help appreciated.

Please post a simple flow with possibly just a couple of Inject nodes, the dropdown node and a debug node and describe what you are seeing with that flow that is not as it should be.

I think i managed to find when its happening.

My requirement is to send both msg.payload and msg.options at the same time to ui-dropdown node.
And when i send a big options Array (15-20 odd entries) the selected value sent via. msg.payload (on the same msg) doesnt show on the screen. (15-20 is not big in my view).

But on next click it shows .
My guess is that on 2nd click the memory is updated with the dropdown options and hence now msg.payload (selected option) is considered as a valid value.

Below is a very simplistic node.
3 function nodes - 1 to reset the dropdown and other 2 to send the data to it.

Reset the node.
inject any of the other functions. The selected option is not seen. Once again on clicking the same inject its seen.

[
    {
        "id": "4a1f8825bd0bea29",
        "type": "inject",
        "z": "aa9948c0135282ce",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 473.3333435058594,
        "y": 2906.6667861938477,
        "wires": [
            [
                "7eaa5e233a32f481"
            ]
        ],
        "l": false
    },
    {
        "id": "7eaa5e233a32f481",
        "type": "function",
        "z": "aa9948c0135282ce",
        "name": "function 168",
        "func": "msg.options = [\n\n{value: \"ABC\", label: \"ABC\"},\n{value: \"2ABC\", label: \"2ABC\"},\n{value: \"3ABC\", label: \"3ABC\"},\n{value: \"4ABC\", label: \"4ABC\"},\n{value: \"5ABC\", label: \"5ABC\"},\n{value: \"6ABC\", label: \"6ABC\"},\n{value: \"7ABC\", label: \"7ABC\"},\n{value: \"8ABC\", label: \"8ABC\"},\n{value: \"9ABC\", label: \"9ABC\"},\n{value: \"10ABC\", label: \"10ABC\"},\n{value: \"11ABC\", label: \"11ABC\"},\n{value: \"12ABC\", label: \"12ABC\"},\n{value: \"13ABC\", label: \"13ABC\"},\n{value: \"14ABC\", label: \"14ABC\"},\n{value: \"15ABC\", label: \"15ABC\"},\n{value: \"16ABC\", label: \"16ABC\"}\n]\n\nmsg.payload = \"15ABC\";\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 600.3333740234375,
        "y": 2906.666748046875,
        "wires": [
            [
                "d249c4e724b0f8bb"
            ]
        ],
        "l": false
    },
    {
        "id": "d249c4e724b0f8bb",
        "type": "ui-dropdown",
        "z": "aa9948c0135282ce",
        "group": "2694a6104da3e1e5",
        "name": "",
        "label": "Select Option:",
        "tooltip": "",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": false,
        "multiple": false,
        "options": [
            {
                "label": "",
                "value": "",
                "type": "str"
            }
        ],
        "payload": "",
        "topic": "topic",
        "topicType": "msg",
        "className": "",
        "x": 759.3333740234375,
        "y": 2903.666748046875,
        "wires": [
            []
        ],
        "l": false
    },
    {
        "id": "69d2074cdd8e6bd4",
        "type": "inject",
        "z": "aa9948c0135282ce",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 477,
        "y": 2956,
        "wires": [
            [
                "d587589dd180fdd0"
            ]
        ],
        "l": false
    },
    {
        "id": "d587589dd180fdd0",
        "type": "function",
        "z": "aa9948c0135282ce",
        "name": "function 169",
        "func": "msg.options = [\n\n{value: \"ABC\", label: \"ABC\"},\n{value: \"2ABC\", label: \"2ABC\"},\n{value: \"3ABC\", label: \"3ABC\"},\n{value: \"4ABC\", label: \"4ABC\"},\n{value: \"5ABC\", label: \"5ABC\"},\n{value: \"6ABC\", label: \"6ABC\"},\n{value: \"7ABC\", label: \"7ABC\"},\n{value: \"8ABC\", label: \"8ABC\"},\n{value: \"9ABC\", label: \"9ABC\"},\n{value: \"10ABC\", label: \"10ABC\"},\n{value: \"11ABC\", label: \"11ABC\"},\n{value: \"12ABC\", label: \"12ABC\"},\n{value: \"13ABC\", label: \"13ABC\"},\n{value: \"14ABC\", label: \"14ABC\"},\n{value: \"15ABC\", label: \"15ABC\"},\n{value: \"16ABC\", label: \"16ABC\"}\n]\n\nmsg.payload = \"2ABC\";\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 604.0000305175781,
        "y": 2955.9999618530273,
        "wires": [
            [
                "d249c4e724b0f8bb"
            ]
        ],
        "l": false
    },
    {
        "id": "33debe7ffb39d8f2",
        "type": "inject",
        "z": "aa9948c0135282ce",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 485,
        "y": 2859,
        "wires": [
            [
                "328c31aefa3019ed"
            ]
        ],
        "l": false
    },
    {
        "id": "328c31aefa3019ed",
        "type": "function",
        "z": "aa9948c0135282ce",
        "name": "function 170",
        "func": "msg.options = []\nmsg.payload = [];\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 612.0000305175781,
        "y": 2858.9999618530273,
        "wires": [
            [
                "d249c4e724b0f8bb"
            ]
        ],
        "l": false
    },
    {
        "id": "2694a6104da3e1e5",
        "type": "ui-group",
        "name": "My Group",
        "page": "3cd86a1c77beed6c",
        "width": "6",
        "height": "1",
        "order": 1,
        "showTitle": true,
        "className": "",
        "visible": "true",
        "disabled": "false"
    },
    {
        "id": "3cd86a1c77beed6c",
        "type": "ui-page",
        "name": "Page 3",
        "ui": "b922b9acf646fc95",
        "path": "/page3",
        "icon": "home",
        "layout": "grid",
        "theme": "4ff3442d1cf69557",
        "order": 3,
        "className": "",
        "visible": true,
        "disabled": "false"
    },
    {
        "id": "b922b9acf646fc95",
        "type": "ui-base",
        "name": "test",
        "path": "/dashboard",
        "includeClientData": true,
        "acceptsClientConfig": [
            "ui-notification",
            "ui-control",
            "ui-button",
            "ui-dropdown",
            "ui-table"
        ],
        "showPathInSidebar": false,
        "navigationStyle": "default",
        "titleBarStyle": "default"
    },
    {
        "id": "4ff3442d1cf69557",
        "type": "ui-theme",
        "name": "Default Theme",
        "colors": {
            "surface": "#ffffff",
            "primary": "#0094CE",
            "bgPage": "#eeeeee",
            "groupBg": "#ffffff",
            "groupOutline": "#cccccc"
        },
        "sizes": {
            "pagePadding": "12px",
            "groupGap": "12px",
            "groupBorderRadius": "4px",
            "widgetGap": "12px"
        }
    }
]

I tried your flow on a old version of dashboard 2 and it worked fine.
When I tried it on latest version I see your issue.
Please raise this on the nodes github page as an issue/bug.

1 Like

Thanks @E1cid . Will do.
Found an additional issue with the node. In case of pass through - the node replaces the payload with empty payload.

It would be ok if D2 nodes do the same. But nodes like Text node etc. maintain the msg.payload property when acting as passthrough.

Will add to the same issue.

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