Vision Power Table call configureHeaderStyle dynamically

Hi there!
Ignition 8.1.0
Vision Power Table component
ConfigureHeader extension function.

TLDR;
Is there a way to dynamically call the configureHeaderStyle extension function? I need to update the header style as new data is selected for the table component.

I’ve got a power table that I am using to show a dataset containing digital IO card data for maintenance troubleshooting on a machine. The table has a custom property called cardBackgroundColor that is bound to an integer member of the card data UDT. I use this integer to control the background color of the header on our HMI faceplates, based on the type of card (input/output/safety etc) and I would like to replicate this same function on our Ignition clients.

I have the logic working properly in the configureHeaderStyle function, but if I change the selected dataset using a tabstrip on the window, then the header returns to its default style.

	return {
		'background': self.cardBackgroundColor
	}

Here is what the header looks like when I open the page on an input card:
image
Then if I select a new card (new tab):
image

Is there a way to force the table to run the function? I’ve tried calling

myTable.configureHeaderStyle()

But this just returns an AttributeError:

AttributeError: 'com.inductiveautomation.factorypmi.application.com' object has no attribute 'configureHeaderStyle'

1 Like

You can't do this directly using the configureHeaderStyle(). Unfortunately, to make it fully dynamic you'll have to suddenly jump a few layers down in Java Swing.

What you can do from configureHeaderStyle is limited - but there are still other options. What you'll have to do is create your own header renderer and set it to be used for the columns of your dataset - likely, each time your dataset changes. There's an example of this technique here:

You can make that a lot more efficient by caching the custom editor as a local (Swing, not Ignition) client property (see this thread: Designer Color Chooser vs Runtime Color Chooser - #4 by PGriffith for more info on that), and simply setting it as the editor for all the appropriate columns on data change.

1 Like

Thanks Paul.
That’s a little more down in the weeds than I was hoping for, but I will give it a shot. I guess I could avoid that by switching this to perspective :grin: