# Table Cell Renderer

**URL:** <https://forum.inductiveautomation.com/t/table-cell-renderer/6488>\
**Category:** Ignition\
**Created:** [May 15, 2013, 6:56pm UTC](https://forum.inductiveautomation.com/t/table-cell-renderer/6488 "2013-05-15T18:56:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![djones](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@djones](https://forum.inductiveautomation.com/u/djones)\
**Post date:** [May 15, 2013, 6:56pm UTC](https://forum.inductiveautomation.com/t/table-cell-renderer/6488/1 "2013-05-15T18:56:38Z")

</div>

I need to vary the background color of a cell based on it’s contents.

I have the following code to return the default cell renderer, change the background color and then reset it. I am unsure if i need to Override/Implement the TableCellRenderer. If so, I don’t have the foggiest idea how to do it.

[code]from javax.swing import JTable  
from javax.swing import JLabel  
from javax.swing.table import \*

import system  
Table = event.source.parent.getComponent(‘Table 2’)  
Table2 = Table.getTable()

dt = Table2.getCellRenderer(1,1)

dt.setBackground(system.gui.color(255,0,0))

Table2.setDefaultRenderer(Table2.class, dt)

Data = event.source.parent.getComponent(‘Table 2’).data

[/code]

---

<div class="post-metadata">

**Author:** ![djones](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@djones](https://forum.inductiveautomation.com/u/djones)\
**Post date:** [May 16, 2013, 1:03am UTC](https://forum.inductiveautomation.com/t/table-cell-renderer/6488/2 "2013-05-16T01:03:21Z")

</div>

Nevermind.

I just figured out that the Background Color Column and the Background Color List in the table customizer do what I want them to do.

See attached Image

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/8/8cff3d71c617d31412c8301435877ad668ec7909.JPG)

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [May 22, 2013, 11:24pm UTC](https://forum.inductiveautomation.com/t/table-cell-renderer/6488/3 "2013-05-22T23:24:31Z")

</div>

I’m glad you got it to work. For what it’s worth, in Ignition 7.6, there is a new way to do this that is more in line with what you originally tried: extension functions. You can now override the Table’s implementation of getBackgroundColorAt() and provide a color for any cell.

---

<div class="post-metadata">

**Author:** ![BFischer](https://avatars.discourse-cdn.com/v4/letter/b/4491bb/32.png) [@BFischer](https://forum.inductiveautomation.com/u/BFischer)\
**Post date:** [June 6, 2013, 9:22pm UTC](https://forum.inductiveautomation.com/t/table-cell-renderer/6488/4 "2013-06-06T21:22:42Z")

</div>

Could someone please provide more of an example regarding how to use the extension function in this case? I’m trying to reference a custom property (e.g. “lowValue”) to compare to the cell’s value and therefore change the background color. I feel like I’m pretty close, but I just can’t quite get there.

`print self.getParent.im_self` returns the name of my table, but I don’t know how to access the custom properties.

Only been working with Ignition for 2 weeks, so please be patient with me. ![:thumb_right:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/2026e28c0c425034352c1b75807edf956adc75f4.gif ":thumb\_right:")

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [June 10, 2013, 4:54pm UTC](https://forum.inductiveautomation.com/t/table-cell-renderer/6488/5 "2013-06-10T16:54:17Z")

</div>

You won’t find much on extension functions in here, because they’re a very new feature, introduced in Ignition 7.6.0.

You should be able to access custom properties simply by doing a [tt]self.propertyName[/tt] reference. But - you found a bug! That didn’t work. (It’ll work in 7.6.2).

In the meantime you can do [tt]self.getPropertyValue(‘propertyName’)[/tt]

Hope this helps,
