Drop down in Power Table cell not working

I am trying to get the Power Table cell to show the drop down with multiple options. After going through few topics I found that it can be achieved using configureEditor extension function and Power Table already has the example for the same.
So, now I have a power table with configureEditor enabled and with following script -

if colIndex == 0: 
		return {'options': [(0, 'A Shift'), (1, 'B Shift'), (2, 'C Shift')]}

isCellEditable extension function enabled with following script -
return True
But power table doesn’t show any drop down in first column. As per one of the topics on forum, user had faced same issue but it got resolved after restarting designer. I tried same but to no avail. I have tried this on version 8.0.7 and 8.0.5 to rule out bug possibility.

Am I missing anything?

Is the column checked as Editable in the Table Customizer?

I checked Editable option for the column but still it is not showing drop down menu :sob:

The configureEditor method is only called when the power table gets loaded with the scripts active (so it doesn’t work in the designer). Make sure to test it in a client.

Thanks a lot! It’s working now. I had checked it once in runtime but the Editable option was not checked.
One more question, I see drop down menu only when I click on cell otherwise it is blank.
image
I was expecting to drop down on un-selected cell as well. Is it possible?

You can use a custom renderer in the configureCell extension function on the Power Table.
For example:

	from javax.swing import JComboBox
	# The same options from configureEditor, except as a dict
	options = {0: 'A Shift', 1: 'B Shift', 2: 'C Shift'}
	# Get the value to display
	if value in options:
		item = options[value]
	else:
		# "Invalid" option
		item = value
	# Create a combo box with only the current value
	jcb = JComboBox([item])
	jcb.setBorder(None)
	jcb.setBackground(self.background)
	return {'renderer': jcb}
1 Like

@camatt3 Thank you for sharing this script and apologies for late reply.
When window opens I need to show the previously selected value in the drop down and also let user to select new value if required. I think I might need store selected value is database or dataset tag. I will check using above script how to get this working.

Thanks again!