# How to change Perspective Table with \`onEditCellCommit\` script to use dropdown in a View?

**URL:** <https://forum.inductiveautomation.com/t/how-to-change-perspective-table-with-oneditcellcommit-script-to-use-dropdown-in-a-view/98491>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [November 11, 2024, 10:54pm UTC](https://forum.inductiveautomation.com/t/how-to-change-perspective-table-with-oneditcellcommit-script-to-use-dropdown-in-a-view/98491 "2024-11-11T22:54:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![r123](https://avatars.discourse-cdn.com/v4/letter/r/838e76/32.png) [@r123](https://forum.inductiveautomation.com/u/r123)\
**Post date:** [November 11, 2024, 10:54pm UTC](https://forum.inductiveautomation.com/t/how-to-change-perspective-table-with-oneditcellcommit-script-to-use-dropdown-in-a-view/98491/1 "2024-11-11T22:54:38Z")

</div>

I'm trying to follow this guide but got stuck on a few things.  
[Ignition Perspective: How to embed views in a table](https://www.youtube.com/watch?v=xQiiJkSnrvg&t=79s)

First I had to redo the embedded View as I'd not selected the Flex Container type. I could not find a way to change it. You can copy the JSON info from the old View but then the objects still have the old none flex settings.

To get it to look like a text field or dropdown is not a separate object in the table you need to add styles to the dropdown object. Under `TextField` and `Dropdown` `PROPS` `style` I added, `backgroundColor`: #00000000 and `border`: none  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/b/6be74f6fb3ea9f7ce91e98b163e0eaf7d18e89b1.png)

I have a perspective table that is currently using an `onEditCellCommit` script to update a tags property by changing the text in any cell in a column. It gets the tags path from the only other column.

I was thinking I'd just be able to pass the new value from the view into the tables cell and trigger the same `onEditCellCommit` script that is already there but I did not have any luck. I also tried moving the script in the `onEditCellStart` script.

I ended up moving the `onEditCellCommit` into the Message Handler script and it's working with the `TextField` view.

Testing with a `TextField` in the view I can see the current value in cell just as though the `TextField` view was not there. This is what I already had without the view, the column was set to `editable` and the `onEditCellCommit` script updated the dataset but I'm wanting to use a `Dropdown` view in each cell with a list of options.

The `TextField` used the expression binding but the example skips over the `Dropdown`s, `value` and `options` bindings.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/3/8367ac36abef2d850a9ed52e47fc328406dbec1a.png)

I can't get the `options` or the current `value` into the `Dropdown` view.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/d/9de8f193f0272485fde2c7fab1433dd85359fd8c.png)

I tried to use the same binding as the `TextField`, `text` for the `Dropdown`, `data` but even if I don't use a binding at all and just hard code the `value` as "test" it still just shows "Select...".

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/7/37a9bd3c96e6484fdf409556766f84d5c25db7cc.png)

For the `Dropdown` `options`, the example shows the `columns` `options` under `viewParams` as a dataset but I can't seem to set it as a dataset.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/0/70d76a8599305d2d2a81279e2ba017f57de78419.png)

---

<div class="post-metadata">

**Author:** ![r123](https://avatars.discourse-cdn.com/v4/letter/r/838e76/32.png) [@r123](https://forum.inductiveautomation.com/u/r123)\
**Post date:** [November 12, 2024, 10:01pm UTC](https://forum.inductiveautomation.com/t/how-to-change-perspective-table-with-oneditcellcommit-script-to-use-dropdown-in-a-view/98491/2 "2024-11-12T22:01:46Z")

</div>

The `Dropdown` was still showing "Select..." because it will not just show whatever it is passed. It seems the value passed must match one of the existing options in the `Dropdown`.

**Maybe there is a setting to change this?**

Once the matching options were added then the view with a `Dropdown` updated with something other than "Select...".  
`options` needs to be an array type and then an `Object` type under it with two `Value` types, `value` and `label`.  
I had tried this but managed to have the value/label in the wrong order, value has to be first.

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/1/417496142429612242329c1367737ff676f1102b.png)

**I'm still wondering how the example in the video [Ignition Perspective: How to embed views in a table](https://www.youtube.com/watch?v=xQiiJkSnrvg&t=79s) was able to have a dataset in the `options` object?**  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/5/7553d0046f6059b3ddb540eee6e3650460f627f4.png)

---

<div class="post-metadata">

**Author:** ![David\_Stone](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/david_stone/32/79749_2.png) [@David\_Stone](https://forum.inductiveautomation.com/u/David_Stone)\
**Post date:** [November 12, 2024, 10:14pm UTC](https://forum.inductiveautomation.com/t/how-to-change-perspective-table-with-oneditcellcommit-script-to-use-dropdown-in-a-view/98491/3 "2024-11-12T22:14:20Z")

</div>

Normally with a sub view in a table I make the event system to update the value inside the subview. I don't believe that the table will register a `onEditCellCommit` on a subview as it is a different object. `onEditCellCommit` is a quick way to capture an 'editable' table cell being edited and respond with an event.  
For a dropdown you would probably bind an event to `onActionPerformed` that takes the new value and inserts it into the correct row in the database based on the values passed to the subview by the table.  
A lot of the time when I do dropdowns, I am pulling all the dropdown option from the database as well, so I bind the `options` parameters with a Query binding that uses python to format the options array exactly how I need it to display.

---

<div class="post-metadata">

**Author:** ![r123](https://avatars.discourse-cdn.com/v4/letter/r/838e76/32.png) [@r123](https://forum.inductiveautomation.com/u/r123)\
**Post date:** [November 12, 2024, 10:46pm UTC](https://forum.inductiveautomation.com/t/how-to-change-perspective-table-with-oneditcellcommit-script-to-use-dropdown-in-a-view/98491/4 "2024-11-12T22:46:30Z")

</div>

When I was just using the `onEditCellCommit` and no embedded View, the column would also show text when no value was found or the custom property did not exist.

I don't want those status values to be options in the `Dropdown` but I would like to see them.

Is there a way to make the dropdown show any value?

Currently the way to mark them back to unused is to enter no value.

* * *

It looks like the `allowCustomOptions` lets you see values not in the `Dropdowns` `options`.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/e/9e12642c0a2f7a0e9766d9a5a5a716f2e3035a9f.png)
