Color palette in a power table

Hello,

I’m trying to get a color palette to update cells in a power table, but I’m unable to get it to populate with the current cell’s value, the color editor pulls up with white as the default every time, so cancelling or hitting escape doesn’t work as expected

I’m using return {'editor' : ColorEditor.createTableCellEditor() } inside of the configureEditor portion of the power table

I’ve tried to set the default color on the ColorEditor object with no luck,

from java.awt import Color
color = Color(0,0,0,255)
colorEditor = ColorEditor()
colorEditor.setSelectedColor(color)
colorEditor = colorEditor.createTableCellEditor()
return {'editor' : ColorEditor.createTableCellEditor()}

I was also messing around with ColorEditor.createTableCellRenderer() inside of configureCell, but that doesn’t work at all, I tried:

return {'renderer' : ColorEditor.createTableCellRenderer()}

So… who knows the trick?

Thanks

I could get it working with this code in the “initialize” function:
from com.inductiveautomation.ignition.client.util.gui.color import ColorEditor
return {‘renderer’ : ColorEditor.createTableCellRenderer()}

and the following code in the “configureEditor” function:
if colName == “myColName”:
from com.inductiveautomation.ignition.client.util.gui.color import ColorEditor
return {‘editor’ : ColorEditor.createTableCellEditor()}

1 Like