# Dropdown not clearing when passing empty array

**URL:** <https://discourse.nodered.org/t/dropdown-not-clearing-when-passing-empty-array/93485>\
**Category:** General\
**Created:** [26 November 2024 20:03 UTC](https://discourse.nodered.org/t/dropdown-not-clearing-when-passing-empty-array/93485 "2024-11-26T20:03:47Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![rbmgf7](https://avatars.discourse-cdn.com/v4/letter/r/c57346/32.png) [@rbmgf7](https://discourse.nodered.org/u/rbmgf7)\
**Post date:** [26 November 2024 20:03 UTC](https://discourse.nodered.org/t/dropdown-not-clearing-when-passing-empty-array/93485/1 "2024-11-26T20:03:47Z")

</div>

For some reason it's not working. It'll clear whatever value is present in the dropdown but the rest of the `msg.options` are still there when you click back on the dropdown.

The instructions also say to pass a Boolean `true` payload under `msg.resetSearch` which doesn't do anything.

---

<div class="post-metadata">

**Author:** ![rbmgf7](https://avatars.discourse-cdn.com/v4/letter/r/c57346/32.png) [@rbmgf7](https://discourse.nodered.org/u/rbmgf7)\
**Post date:** [26 November 2024 20:09 UTC](https://discourse.nodered.org/t/dropdown-not-clearing-when-passing-empty-array/93485/2 "2024-11-26T20:09:06Z")

</div>

Dang it. I figured it out. Sending an empty array to `msg.payload` clears the bar and sending an empty array to the same dropdown as `msg.options` clears the list of items sent in that options payload.

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [27 November 2024 01:23 UTC](https://discourse.nodered.org/t/dropdown-not-clearing-when-passing-empty-array/93485/3 "2024-11-27T01:23:15Z")

</div>

Is there a way to trigger the dropdown from a message instead of user clicking on it ?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 November 2024 08:15 UTC](https://discourse.nodered.org/t/dropdown-not-clearing-when-passing-empty-array/93485/4 "2024-11-27T08:15:12Z")

</div>

What do you mean by triggering it?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 November 2024 08:18 UTC](https://discourse.nodered.org/t/dropdown-not-clearing-when-passing-empty-array/93485/5 "2024-11-27T08:18:40Z")

</div>

If you mean that you want to select an entry and act as if the user had clicked that entry then, as described in the help text, if you pass in msg.payload with the value it will select it, and if you have message passthrough enabled in the node then that will also be passed to the next node.

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [27 November 2024 08:45 UTC](https://discourse.nodered.org/t/dropdown-not-clearing-when-passing-empty-array/93485/6 "2024-11-27T08:45:13Z")

</div>

By triggering I meant to activate the dropdown menu as though the user has clicked to select an option. I am aware I can set a default value to show by sending value in msg.payload, but all I need is to grab attention of the user that when ready, the user now **can** select an option from the dropdown. Due to my layout, the position of the dropdown is not very revealing, and an automatic dropdown would grab the attention of the user. or a pulsing of the widget or something, I now use msg.enabled =true and =false two times, to get that affect, but i thought a literal dropdown without the user clicking gives a more prominent attention seek. a background color change also would give me what I want and am looking into it now..

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [27 November 2024 08:59 UTC](https://discourse.nodered.org/t/dropdown-not-clearing-when-passing-empty-array/93485/7 "2024-11-27T08:59:22Z")

</div>

For dropdown add class `blinkable`

A bit of CSS (for all pages)

```auto
.blinkable.blink{
    animation: blink 0.5s infinite;
}
@keyframes blink {
    50% {
        filter: brightness(0.4);
    }
}

```

or if the background color works better

```auto
.blinkable.blink{
    animation: blink 0.5s infinite;
}
@keyframes blink {
    50% {
        background: rebeccapurple;
    }
}

```

And then send message to the dropdown with  
`msg.class = "blink"` to animate it and `msg.class = ""` to put it back steady.

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [27 November 2024 12:43 UTC](https://discourse.nodered.org/t/dropdown-not-clearing-when-passing-empty-array/93485/8 "2024-11-27T12:43:21Z")

</div>

thanks but, sorry, will this work for old dashboard dropdown ?

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [27 November 2024 12:46 UTC](https://discourse.nodered.org/t/dropdown-not-clearing-when-passing-empty-array/93485/9 "2024-11-27T12:46:29Z")

</div>

Probably not directly but can't even test anymore. Uninstalled from all of my instances...

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [27 November 2024 12:47 UTC](https://discourse.nodered.org/t/dropdown-not-clearing-when-passing-empty-array/93485/10 "2024-11-27T12:47:26Z")

</div>

i just checked... msg.className is working!

> [@hotNipi](#):
>
> And then send message to the dropdown with  
> `msg.class = "blink"` to animate it and `msg.class = ""` to put it back steady.

if someone is interested, the suggestion by @hotNipi works in older dashboard also if you just change the `msg.class` to `msg.className`  
It is in the docs.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/c/6cb5d2147ebccccb861f78c1febdd7a36ecad257.png)

![flash](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/c/4cba2c70519be4155a74e8424d26058013259ad4.gif)

---

<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:** [11 December 2024 12:48 UTC](https://discourse.nodered.org/t/dropdown-not-clearing-when-passing-empty-array/93485/11 "2024-12-11T12:48:21Z")

</div>

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