Power Table configureCell - DropDown List

Hello,

I am trying to use the configureCell Extension Function in the Power Table to look at the value of one column and build a drop-down of relevant items in another column based on the first value for each row.

Taking baby steps here as I haven’t ever really gotten into the java swing stuff. I can’t even get the combo box to render correctly and was hoping the fine folks on the forum could point me in the right direction.

The following does put a combo box into my Value column with either Line 1 or Machine 1 being displayed depending on the value of “Parameter” for each row. But when I click on it the combo box goes away and it reverts to a text box. All the Jython examples I’ve found on the web talk about handlers but I’m not even sure you can do that in the power table extension functions. And I don’t think I can use the configureEditor function because I can’t access rowIndex.

Thanks in advance -

[code] from javax.swing import JComboBox

print value

if colName == "Value":
	param = self.data.getValueAt(rowIndex,"Parameter")
	if param == "Line":
		return {'renderer': JComboBox(["Line 1", "Line 2", "Line 3"])}
	elif param == "Machine":
		return {'renderer': JComboBox(["Machine 1", "Machine 2", "Machine 3"])}[/code]

Use the configureEditor extension function.

How do you access values from specific rows using the configureEditor extension function?

I have a table with two columns: “parameter” and “value”. I want to use the text in each row’s “parameter” column to populate a dropdown in the “value”. So one row’s dropdown items would be “Line 1”, “Line 2”, “Line 3” while another row’s dropdown items would be “Machine 1”, “Machine 2”, “Machine 3”.

My understanding of the configureEditor function was that you were formatting all rows for a given column. But this is all relatively new to me so perhaps I’m mistaken.

1 Like