Refresh Power Table Extension Functions

Hi All,

See screen shot for clarity on layout and functionality. The problem is described below the image.

[attachment=0]powertable.JPG[/attachment]

I am using a power table’s configureCell extension function to do condition formatting much like what is available in excel. The code is solid and works as desired.

The issue that I am having occurs when you switch the signal via the tab strip. The conditional formatting will change to the wrong color, but if you scroll down and then back up the right color is displayed.

Is there a way to refresh the Java renderer that drives the individual cell color? I tried to refresh the dataset using system.db.refresh, but it did not do what I need it to.

Thanks for any insight!

Okay, I figured out a fix. If you feel its not pretty enough, then please let me know as I am always willing to expand my skills.

I used the javax.swing.table repaint() function. You can place it on the property change event handler of the power table. You call it by accessing the component via event.source.parent.getComponent(‘Power Table’).repaint().

Please correct me if I am wrong. My understanding is that it forces java to re-render the table every time a table property changes.

1 Like

You can make it even more simple and more general by call event.source.repaint()

In my case power table need to be repaint only when data are changed so I call it like this in propertyChange script of Power Table:

if event.propertyName == "data" :
	event.source.repaint()

I’m using Ignition 7.9

You’re referring to the same method. Ray was accessing it from a sibling tab strip that contributed to the coloring of the table. Your method only applies to table data changes, but is superfluous because table data changes cause the repaint anyways. The OP wanted a repaint when the table data wasn’t changing.