# Vision Power Table call configureHeaderStyle dynamically

**URL:** <https://forum.inductiveautomation.com/t/vision-power-table-call-configureheaderstyle-dynamically/40695>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [November 16, 2020, 4:14pm UTC](https://forum.inductiveautomation.com/t/vision-power-table-call-configureheaderstyle-dynamically/40695 "2020-11-16T16:14:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dustin.cooper](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dustin.cooper/32/29963_2.png) [@dustin.cooper](https://forum.inductiveautomation.com/u/dustin.cooper)\
**Post date:** [November 16, 2020, 4:14pm UTC](https://forum.inductiveautomation.com/t/vision-power-table-call-configureheaderstyle-dynamically/40695/1 "2020-11-16T16:14:51Z")

</div>

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.

```auto
	return {
		'background': self.cardBackgroundColor
	}

```

Here is what the header looks like when I open the page on an input card:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/4/c4e5841d184fe82cb4c76b8a8862b8e7b5782cc4.png)  
Then if I select a new card (new tab):  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/e/5e0b5ae4de5604aa3b289059600f61e792728e66.png)

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

```auto
myTable.configureHeaderStyle()

```

But this just returns an AttributeError:

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

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 16, 2020, 4:27pm UTC](https://forum.inductiveautomation.com/t/vision-power-table-call-configureheaderstyle-dynamically/40695/2 "2020-11-16T16:27:12Z")

</div>

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:

> [@Table headers not centered](http://forum.inductiveautomation.com/t/table-headers-not-centered/19969/5):
>
> You’ll probably want this to fire automatically - probably on propertyChange of the data attribute, but this should get you started. table.getColumnModel().getColumn(1) sets the index of the column to modify (from 0, counting from left to right). from javax.swing.table import TableCellRenderer table = event.source.parent.getComponent('Table').getTable() class NonSortableHeaderRenderer(TableCellRenderer): def getTableCellRendererComponent(self, table, value, selected, focused, row, col): re…

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](http://forum.inductiveautomation.com/t/designer-color-chooser-vs-runtime-color-chooser/32505/4) for more info on that), and simply setting it as the editor for all the appropriate columns on data change.

---

<div class="post-metadata">

**Author:** ![dustin.cooper](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dustin.cooper/32/29963_2.png) [@dustin.cooper](https://forum.inductiveautomation.com/u/dustin.cooper)\
**Post date:** [November 16, 2020, 5:47pm UTC](https://forum.inductiveautomation.com/t/vision-power-table-call-configureheaderstyle-dynamically/40695/3 "2020-11-16T17:47:32Z")

</div>

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 😁
