Add drop down box to power table

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?

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")]

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')]}

But it does not seem to be working.

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

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

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')]}

No worries :slight_smile:
So, your example is almost right - this should work:

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 and 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.

1 Like

list(enumerate(choices)

cute

1 Like

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

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

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

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.

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

1 Like

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