# \[Perspective\] Turn table columns into dropdown

**URL:** <https://forum.inductiveautomation.com/t/perspective-turn-table-columns-into-dropdown/62332>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [July 27, 2022, 6:58am UTC](https://forum.inductiveautomation.com/t/perspective-turn-table-columns-into-dropdown/62332 "2022-07-27T06:58:12Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![n.meluccio](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/n.meluccio/32/4858_2.png) [@n.meluccio](https://forum.inductiveautomation.com/u/n.meluccio)\
**Post date:** [July 27, 2022, 6:58am UTC](https://forum.inductiveautomation.com/t/perspective-turn-table-columns-into-dropdown/62332/1 "2022-07-27T06:58:12Z")

</div>

Hello there,  
i’m facing issues using a table column dropdown list.

 ![1](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/5/45fe20e8f376421aad1ec46192383dbc1fde3013.jpeg)  
 ![2](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/1/d1d27f74ce73ad29cc5e59a3d5754d72826ef2a0.jpeg)  
 ![3](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/7/a7fc4d8058a46be5f173d4aa92cf87ae480eef1b.jpeg)

When i change the selection in the dropdown, the table.data doesn’t receive the updated value. Seems like nothing happens.

**Selected row dropdown value changed and row results:**  
 ![5](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/5/d57a52d73f6feb5bef8f00a6c1debc36285ac1fa.jpeg)

**Ignition version: 8.1.18**

**Dropdown view: params**  
 ![Dropdown_view_params](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/4/04a89e1f1896687baadb4b0eea8a4d793f2e168a.jpeg)

**Dropdown view: VALUE binding**

 ![Dropdown_props_value_binding](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/1/616a9a1990d58bf1225d369d5a9f293b45d1ebcb.jpeg)

**Dropdown view: OPTIONS binding**

 ![Dropdown_props_options_binding](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/d/7dce927fbbc93dbf1613e8fd5b2d24261c5556dd.jpeg)

**Dropdown view: onActionPerformed script**

 ![Dropdown_event_script](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/8/783763446823a52e848347f1066dc8e7631294a8.jpeg)

**Table view: Columns properties + viewPath + viewParams**

 ![Table_column_viewPath_viewParams](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/5/55fd7842474fdf694d7d3f5fd3dccb72fbdf792c.jpeg)

**Table view: Message handler**

 ![Table_script_message_handler](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/0/e0f794c9740691bce600171b560a118a04247be1.jpeg)

**Table view: onEditCellCommit**

 ![Table_script_onEditCellCommit](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/9/191a1653fe34d3722546ab8cefe99deddb4ca9b4.jpeg)

is there something i am doing wrong?

Any help would be appreciated.  
Thank you in advance.

_N._

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [July 27, 2022, 7:08am UTC](https://forum.inductiveautomation.com/t/perspective-turn-table-columns-into-dropdown/62332/2 "2022-07-27T07:08:31Z")

</div>

I’m not sure what you’re trying to do, can you explain the use case ?  
I’m also not sure you should put bindings on dropdowns’ value property.

---

<div class="post-metadata">

**Author:** ![n.meluccio](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/n.meluccio/32/4858_2.png) [@n.meluccio](https://forum.inductiveautomation.com/u/n.meluccio)\
**Post date:** [July 27, 2022, 7:35am UTC](https://forum.inductiveautomation.com/t/perspective-turn-table-columns-into-dropdown/62332/3 "2022-07-27T07:35:57Z")

</div>

i’d like to have an editable column with a dropdown so that the user select from a list of values.

That table will be used to save data to SQL.

Right now, with those settings, even if i choose a value from the dropdown list the table return an empty value in that column, like it does not write the dropdown value into the table dataset.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [July 27, 2022, 8:04am UTC](https://forum.inductiveautomation.com/t/perspective-turn-table-columns-into-dropdown/62332/4 "2022-07-27T08:04:40Z")

</div>

scope should probably be page instead of view.

> [@n.meluccio](#):
>
> ![Dropdown_event_script](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/8/783763446823a52e848347f1066dc8e7631294a8.jpeg)
> 
> Dropdown\_event\_script1577×891 102 KB

Updating the table directly is dangerous... Because im guessing you want the tables data to be filled by a binding it self. This will cause the binding to rewrite the data, so the users edit will be lost. Either update the sql directly here, or if they have to press a confirm button somewhere first, save all the changes seperately and make your table combine the pulled data and the changes

> [@n.meluccio](#):
>
> ![Table_script_message_handler](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/0/e0f794c9740691bce600171b560a118a04247be1.jpeg)
> 
> Table\_script\_message\_handler1011×763 61.5 KB

I dont think this will do anything because the event comes from the combobox and not from the tables onEdit, so you can delete this.

> [@n.meluccio](#):
>
> ![Table_script_onEditCellCommit](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/9/191a1653fe34d3722546ab8cefe99deddb4ca9b4.jpeg)
> 
> Table\_script\_onEditCellCommit911×889 72.3 KB

---

<div class="post-metadata">

**Author:** ![n.meluccio](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/n.meluccio/32/4858_2.png) [@n.meluccio](https://forum.inductiveautomation.com/u/n.meluccio)\
**Post date:** [July 27, 2022, 8:11am UTC](https://forum.inductiveautomation.com/t/perspective-turn-table-columns-into-dropdown/62332/5 "2022-07-27T08:11:57Z")

</div>

> [@victordcq](#):
>
> scope should probably be page instead of view.

I tried with both, page and view.

> [@victordcq](#):
>
> Updating the table directly is dangerous… Because im guessing you want the tables data to be filled by a binding it self.

No, the table.data is fullfilled by the user (he can add / remove rows and set some data in any row)

> [@victordcq](#):
>
> Either update the sql directly here, or if they have to press a confirm button somewhere first, save all the changes seperately and make your table combine the pulled data and the changes

When the user has compiled the table with some data, there will be a confirm button underneath it that read the table.data and save to SQL.

> [@victordcq](#):
>
> I dont think this will do anything because the event comes from the combobox and not from the tables onEdit, so you can delete this.

i thought that the table had to "read" the payload that the dropdown sent with perspective.sendMessage(). Isn't it right?

I'm literally stuck.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [July 27, 2022, 8:38am UTC](https://forum.inductiveautomation.com/t/perspective-turn-table-columns-into-dropdown/62332/6 "2022-07-27T08:38:49Z")

</div>

use row instead of rowIndex (incase you have different pages and stuff, row is better)  
using scope page it works for me

Note that the first data entry is structed different tho. normaly its `city:thecity`, but for folsom its `city:{value:folsom ,style:...}`  
[testColmnTable.zip](https://forum.inductiveautomation.com/uploads/short-url/73EShEWEyI7SioNioznpgsRK00r.zip) (75.7 KB)

> [@n.meluccio](#):
>
> i thought that the table had to “read” the payload that the dropdown sent with perspective.sendMessage(). Isn’t it right?

yes but the onCellEdit does not get triggered

---

<div class="post-metadata">

**Author:** ![n.meluccio](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/n.meluccio/32/4858_2.png) [@n.meluccio](https://forum.inductiveautomation.com/u/n.meluccio)\
**Post date:** [July 27, 2022, 9:17am UTC](https://forum.inductiveautomation.com/t/perspective-turn-table-columns-into-dropdown/62332/7 "2022-07-27T09:17:10Z")

</div>

Found the problem that i had:

> params = {"row":self.view.params.row, **"value":self.props.value** }
> 
> system.perspective.sendMessage('updateTableColumn', payload = params, scope = 'page')

i binded {"value": **self.props.value** } to {"value": **self.view.params.value** } and that caused the issue.

Thank you @victordcq

---

<div class="post-metadata">

**Author:** ![kenny.tucker](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@kenny.tucker](https://forum.inductiveautomation.com/u/kenny.tucker)\
**Post date:** [August 8, 2024, 2:48pm UTC](https://forum.inductiveautomation.com/t/perspective-turn-table-columns-into-dropdown/62332/8 "2024-08-08T14:48:33Z")

</div>

I have exact setup as the pics above. I am getting an error for the onMessagedRecieved: TypeError: 'com.inductiveautomation.ignition.gateway.datasource.BasicStreamingDataset' object is unsubscriptable

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [August 8, 2024, 3:25pm UTC](https://forum.inductiveautomation.com/t/perspective-turn-table-columns-into-dropdown/62332/9 "2024-08-08T15:25:07Z")

</div>

You're going to have to give us more details, but that error means you're trying to access a dataset like if it was a list. You can't do that.

---

<div class="post-metadata">

**Author:** ![kenny.tucker](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@kenny.tucker](https://forum.inductiveautomation.com/u/kenny.tucker)\
**Post date:** [August 8, 2024, 3:44pm UTC](https://forum.inductiveautomation.com/t/perspective-turn-table-columns-into-dropdown/62332/10 "2024-08-08T15:44:51Z")

</div>

Yep, so I had the table.data property setup as an array instead of a json. thanks for the nugget!
