# Add drop down box to power table

**URL:** <https://forum.inductiveautomation.com/t/add-drop-down-box-to-power-table/43940>\
**Category:** Ignition\
**Created:** [March 1, 2021, 1:20pm UTC](https://forum.inductiveautomation.com/t/add-drop-down-box-to-power-table/43940 "2021-03-01T13:20:55Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![toddayers](https://avatars.discourse-cdn.com/v4/letter/t/8baadc/32.png) [@toddayers](https://forum.inductiveautomation.com/u/toddayers)\
**Post date:** [March 1, 2021, 1:20pm UTC](https://forum.inductiveautomation.com/t/add-drop-down-box-to-power-table/43940/1 "2021-03-01T13:20:55Z")

</div>

Is it possible to have a column within a power table that is called Status and within each actual row of the table make the box underneath the Status column be an actual dropdown selection option?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 1, 2021, 3:52pm UTC](https://forum.inductiveautomation.com/t/add-drop-down-box-to-power-table/43940/2 "2021-03-01T15:52:03Z")

</div>

Yes. We don’t have a great manual example for it, but you want to implement the `configureEditor` extension function, and return a dictionary with an `options` key in it for your `Status` column. The `options` value should be a list of value : label tuples, as in:  
`[(0, "Off"), (1, "Hand"), (2, "Auto")]`

---

<div class="post-metadata">

**Author:** ![toddayers](https://avatars.discourse-cdn.com/v4/letter/t/8baadc/32.png) [@toddayers](https://forum.inductiveautomation.com/u/toddayers)\
**Post date:** [March 3, 2021, 12:56pm UTC](https://forum.inductiveautomation.com/t/add-drop-down-box-to-power-table/43940/3 "2021-03-03T12:56:01Z")

</div>

Hmmm… I believe I may be confused on how this is supposed to work… This is what I have:

```
Choices = ("Pass", "Fail")
if colName == 'Status':
	return {'Choices': [(0, 'Pass'), (1, 'Fail')]}
```

---

<div class="post-metadata">

**Author:** ![toddayers](https://avatars.discourse-cdn.com/v4/letter/t/8baadc/32.png) [@toddayers](https://forum.inductiveautomation.com/u/toddayers)\
**Post date:** [March 3, 2021, 12:56pm UTC](https://forum.inductiveautomation.com/t/add-drop-down-box-to-power-table/43940/4 "2021-03-03T12:56:15Z")

</div>

But it does not seem to be working.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 3, 2021, 4:31pm UTC](https://forum.inductiveautomation.com/t/add-drop-down-box-to-power-table/43940/5 "2021-03-03T16:31:40Z")

</div>

Your key needs to be `'options'` (all lowercase), not `'Choices'`:

```python
if colName == 'Status':
	choices = ("Pass", "Fail")
	return {'options': list(enumerate(choices))}

```

---

<div class="post-metadata">

**Author:** ![toddayers](https://avatars.discourse-cdn.com/v4/letter/t/8baadc/32.png) [@toddayers](https://forum.inductiveautomation.com/u/toddayers)\
**Post date:** [March 3, 2021, 4:42pm UTC](https://forum.inductiveautomation.com/t/add-drop-down-box-to-power-table/43940/6 "2021-03-03T16:42:18Z")

</div>

Please forgive me but I am not a programmer and this makes no sense to me…lol

This is what I put(trying to understand what you have written).

```
if colName == 'Status':
	choices = ("Pass", "Fail")
	return {'options': list[(0, 'Pass'), (1, 'Fail')]}
```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 3, 2021, 5:23pm UTC](https://forum.inductiveautomation.com/t/add-drop-down-box-to-power-table/43940/7 "2021-03-03T17:23:18Z")

</div>

> [@toddayers](#):
>
> Please forgive me but I am not a programmer and this makes no sense to me…lol

No worries 🙂  
So, your example is _almost_ right - this should work:

```python
if colName == 'Status':
	return {'options': [(0, 'Pass'), (1, 'Fail')]}

```

Python (Ignition uses a scripting language called Jython) uses braces `{}`, parentheses `()`, and square brackets `[]` as literals for certain types of data structures - `[]` creates a list, and should be the preferred option if you have a fixed set of items. `()` around at least two items creates a 'tuple' - a read-only, ordered collection of items. The `options` return format expects a _list_ of _tuples_ - so you can return `[(0, 'Pass'), (1, 'Fail')]` directly.

My example uses the `choices` variable that you used, combined with two Python builtin functions ([`enumerate`](https://docs.python.org/2.7/library/functions.html#enumerate) and [`list`](https://docs.python.org/2.7/library/functions.html#func-list)) to return the exact same list format, but without manually specifying the values. It's a totally optional 'enhancement', and will only work as long as your expected values start from 0 and go up by 1 each time.

---

<div class="post-metadata">

**Author:** ![chasondeshotel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chasondeshotel/32/20032_2.png) [@chasondeshotel](https://forum.inductiveautomation.com/u/chasondeshotel)\
**Post date:** [March 3, 2021, 5:51pm UTC](https://forum.inductiveautomation.com/t/add-drop-down-box-to-power-table/43940/8 "2021-03-03T17:51:29Z")

</div>

> `list(enumerate(choices)`

cute

---

<div class="post-metadata">

**Author:** ![toddayers](https://avatars.discourse-cdn.com/v4/letter/t/8baadc/32.png) [@toddayers](https://forum.inductiveautomation.com/u/toddayers)\
**Post date:** [March 3, 2021, 6:28pm UTC](https://forum.inductiveautomation.com/t/add-drop-down-box-to-power-table/43940/9 "2021-03-03T18:28:14Z")

</div>

That does not seem to work either. Do I need to have a drop component overlay the status column or something?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 3, 2021, 6:29pm UTC](https://forum.inductiveautomation.com/t/add-drop-down-box-to-power-table/43940/10 "2021-03-03T18:29:10Z")

</div>

Is your column actually editable? Check the table customizer. You will probably also need to implement the `isCellEditable` extension function.

---

<div class="post-metadata">

**Author:** ![toddayers](https://avatars.discourse-cdn.com/v4/letter/t/8baadc/32.png) [@toddayers](https://forum.inductiveautomation.com/u/toddayers)\
**Post date:** [March 3, 2021, 6:33pm UTC](https://forum.inductiveautomation.com/t/add-drop-down-box-to-power-table/43940/11 "2021-03-03T18:33:17Z")

</div>

Ah… so implementing the isCellEditable function allow me to type in the field, but when I also select the  
editable checkbox in the table customizer, then the Pass/Fail dropdown shows up…  
but when I select either one, nothing actually shows up… LOL

---

<div class="post-metadata">

**Author:** ![toddayers](https://avatars.discourse-cdn.com/v4/letter/t/8baadc/32.png) [@toddayers](https://forum.inductiveautomation.com/u/toddayers)\
**Post date:** [March 3, 2021, 6:36pm UTC](https://forum.inductiveautomation.com/t/add-drop-down-box-to-power-table/43940/12 "2021-03-03T18:36:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 3, 2021, 6:38pm UTC](https://forum.inductiveautomation.com/t/add-drop-down-box-to-power-table/43940/13 "2021-03-03T18:38:29Z")

</div>

Are you also implementing `onCellEdited` or whatever it’s called? You need to write the selected value from the dropdown back to the dataset to actually change anything.

---

<div class="post-metadata">

**Author:** ![toddayers](https://avatars.discourse-cdn.com/v4/letter/t/8baadc/32.png) [@toddayers](https://forum.inductiveautomation.com/u/toddayers)\
**Post date:** [March 3, 2021, 6:42pm UTC](https://forum.inductiveautomation.com/t/add-drop-down-box-to-power-table/43940/14 "2021-03-03T18:42:49Z")

</div>

Ah… I believe that was it! Thank you very much…

---

<div class="post-metadata">

**Author:** ![toddayers](https://avatars.discourse-cdn.com/v4/letter/t/8baadc/32.png) [@toddayers](https://forum.inductiveautomation.com/u/toddayers)\
**Post date:** [March 3, 2021, 7:36pm UTC](https://forum.inductiveautomation.com/t/add-drop-down-box-to-power-table/43940/15 "2021-03-03T19:36:15Z")

</div>

Would you mind if I ask you one more question about this table and drop down I have been working on?
