Pre-populate drop down dashboard node

in one of my flows I want to use the dashboard drop down node (ui_dropdown) to select a number from 1 to 45. After the number is selected it is then read to flow.set to preserve that number across reboots. The help panel says that by "setting msg.payload to one of the item values will preset the choice in the dropdown." After being unable to make it work in my flow I setup another tab with only an inject node and the dropdown node. Put five fields in the dropdown node, all fields set to number and the fields were populated from 1 to 5, in both the value and label field. The inject node was set to number field and alternatively I ran each number from 1 to 5 and injected that into the dropdown node. None of these set the dropdown to a value. Am I misunderstanding the setup of this node? It appears to me to be one of the core nodes. Apparently I cannot understand how to set the value via a msg.;payload.
Any input would be appreciated. I'm not going to export my flow at this time as it is simply just an inject node and the dropdown node that doesn't work at this time.
Thanks
by the way I am running the latest versions of node red as I re-ran the update script just before doing my tests. node-red version was 1.27, didn't check the other versions as the script appeared to run successfully and the node red version matched what I thought it should be, PI 3 B+ raspbian running all the latest updates, did a update/upgrade just before running the node red script

This is what I used to pre-fill a drop-down menu.

My node doesn't appear to have the same fields as your picture? Is is possible I'm mistaken that this is a core node?

drop down

drop down 1

I think my flow used the ui_dropdown widget. You need to remove all the Options that you have in your screen-shot as they will be populated by the flow.

just removed all options re-deployed flow and that didn't seem to work either

You need to click the 'Inject' node, then look in the Dashboard at the dropdown.

Note:
You won't see the values in the widget.

You'll have to change the input name-value pairs as my example was for a weather station at home.

when I inject the number then look in the dashboard it has no effect, I have 3 inject nodes set to msg.payload with number and they are set 1, 2, 3
When I click the inject node the dashboard does not change

drop down 2

Ok, so in desperation I totally rebooted my Pi and it now seems to work. At least for now. No idea why but thank you for your help.
[edit]
that was at least the third reboot too
[edit again]
i think that was multiple reboots, I'm so confused now I think I'll go get a beer

Having a beer sounds like a good plan.

Did you try my flow???

Sometimes you need to clear the brower's cache by holding down the Control Key and clicking F5.

... and sometimes clearing the brain cache helps too :slight_smile: :beers:

1 Like

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