# Dropdown in dock not updating on property change

**URL:** <https://forum.inductiveautomation.com/t/dropdown-in-dock-not-updating-on-property-change/63453>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [August 25, 2022, 2:09pm UTC](https://forum.inductiveautomation.com/t/dropdown-in-dock-not-updating-on-property-change/63453 "2022-08-25T14:09:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [August 25, 2022, 2:09pm UTC](https://forum.inductiveautomation.com/t/dropdown-in-dock-not-updating-on-property-change/63453/1 "2022-08-25T14:09:58Z")

</div>

I’ve got a dock in a project that has a dropdown on it. The dropdown is getting the options from a custom property on the view, and the value for the dropdown is bi-directionally bound to a custom property as well.  
Sometimes I need that dropdown to be user selectable, other times I need it to be set when that dock is opened.  
At the times I need the value to be set, I will send a message to the dock with the value that I need it to be and then open the dock. However, the dropdown list isn’t changed to the value that I’m passing in via the message.

I added a label to the dock just to check the custom property that I’m getting from the message, and that property is getting set. The value of the dropdown is also getting set, it just isn’t triggering the dropdown to select that corresponding item from the list.

Once the dock is open, if I manually change that property via a numeric entry etc… the dropdown is triggered to select the item.

Is this a bug? Or is this intended functionality? Or is there something else going on here?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [August 25, 2022, 9:20pm UTC](https://forum.inductiveautomation.com/t/dropdown-in-dock-not-updating-on-property-change/63453/2 "2022-08-25T21:20:05Z")

</div>

There's a few things that could cause this, but I'm afraid I'm going to need some clarification before I can really help all that much.

> [@bschroeder](#):
>
> I will send a message to the dock

As in `system.perspective.sendMessage()`? This could fail if there are multiple docks on that side of the page and this dock wasn't the last open dock. Also, does the listener reside on the `root`?

You specify that you also open the dock during this sequence; is the dock interaction within the same script, or is it a separate action? if you have multiple actions attached to one event, there is no guarantee of which will happen first. In the event you DO have multiple docks on that side and the dock with your dropdown was not the most recently used dock, the send message call could complete and find no listener, then the dock would be expanded after that.

Could I get some examples of the available options and which option you are trying to set the value to? Does this happen every time or is it sporadic/hit-and-miss?

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [August 25, 2022, 9:43pm UTC](https://forum.inductiveautomation.com/t/dropdown-in-dock-not-updating-on-property-change/63453/3 "2022-08-25T21:43:22Z")

</div>

It’s two different scripts, there are a couple of docks, but the message is unique to the dock.

The data gets to the dock no problem… Its just the drop-down down go to the value I pass in via the message.

I’ll be in a better situation tomorrow to put together a concrete example.

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [August 26, 2022, 1:54pm UTC](https://forum.inductiveautomation.com/t/dropdown-in-dock-not-updating-on-property-change/63453/4 "2022-08-26T13:54:14Z")

</div>

OK a bit more information.

I’m using `system.perspective.sendMessage()` to the dock however, the message is unique to the dock in question. The listener for this message resides on the `root` of the view.

There are multiple docks on that side of the page however, none are active when I’m doing this test.

The script that I use to initiate sending the message and the dock is as follows:

```auto
def runAction(self, event):
	dockId = 'dockNewPO'
	system.perspective.openDock(id=dockId,params={'dockId':dockId})
	system.perspective.sendMessage('On-Dock-New-PO',payload={'terminalId':self.view.params.id})

```

On the dock, the data is getting to the `props.value` for the dropdown. If I add a property change script on that prop I can see the data changing… it’s just not changing the dropdown itself to the correct item in the dropdown list.

The options that are in the dropdown look like this: (note the values are valid, the label is changed for privacy). This is also a custom property sitting on the view itself.

```auto
[
  {
    "label": "Location A",
    "value": 34
  },
  {
    "label": "Location B",
    "value": 30
  },
  {
    "label": "Location B",
    "value": 2
  },
  {
    "label": "Location C",
    "value": 31
  },
  {
    "label": "Location D",
    "value": 38
  }
]

```

And in this specific instance, I’m trying to set the value of the dropdown to 34 via the message.

The way I’m going this is 100% repeatable.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [August 26, 2022, 3:45pm UTC](https://forum.inductiveautomation.com/t/dropdown-in-dock-not-updating-on-property-change/63453/5 "2022-08-26T15:45:50Z")

</div>

Is there any chance you’re sending the value as a string instead of the numeric value? How is the Primary View receiving this `id` value before eventually sending it to the Dropdown?

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [August 26, 2022, 3:49pm UTC](https://forum.inductiveautomation.com/t/dropdown-in-dock-not-updating-on-property-change/63453/6 "2022-08-26T15:49:29Z")

</div>

Ahhh… It is possible. I’ll check in a bit.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [August 26, 2022, 3:50pm UTC](https://forum.inductiveautomation.com/t/dropdown-in-dock-not-updating-on-property-change/63453/7 "2022-08-26T15:50:27Z")

</div>

Try modifying your script to always send the payload value as an int, and see if that fixes it:

```auto
system.perspective.sendMessage('On-Dock-New-PO',payload={'terminalId':int(self.view.params.id}))

```

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [August 26, 2022, 4:33pm UTC](https://forum.inductiveautomation.com/t/dropdown-in-dock-not-updating-on-property-change/63453/8 "2022-08-26T16:33:11Z")

</div>

ding ding ding that fixed it.

I can’t believe I didn’t see that. Sigh.

Thanks for your help!
