# PowerTable Cell Border Color on tab or arrow key

**URL:** <https://forum.inductiveautomation.com/t/powertable-cell-border-color-on-tab-or-arrow-key/104266>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [March 26, 2025, 5:52pm UTC](https://forum.inductiveautomation.com/t/powertable-cell-border-color-on-tab-or-arrow-key/104266 "2025-03-26T17:52:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasongrant15](https://avatars.discourse-cdn.com/v4/letter/j/51bf81/32.png) [@jasongrant15](https://forum.inductiveautomation.com/u/jasongrant15)\
**Post date:** [March 26, 2025, 5:52pm UTC](https://forum.inductiveautomation.com/t/powertable-cell-border-color-on-tab-or-arrow-key/104266/1 "2025-03-26T17:52:12Z")

</div>

I've done some searching on the forums and tried to use the configurecell functionality however, I can't seem to figure this out.

I am trying to change the color or thickness of the border when you click on a cell, but then tab or arrow to another cell. So, the selection is not in the cell. I know I can change the border once I am 'editing' the contents of a cell, but I can't figure out how to modify the border highlight when arrowing/tabing around on a table. I've included a screenshot of the tabbing/arrowing styling.

Thank you for any help!

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/c/fc09f6a567bbd909f048d787eced521f38362970.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 26, 2025, 5:53pm UTC](https://forum.inductiveautomation.com/t/powertable-cell-border-color-on-tab-or-arrow-key/104266/2 "2025-03-26T17:53:59Z")

</div>

You'll need custom properties to **remember** the row and column that you want to highlight regardless what is otherwise selected.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [March 31, 2025, 5:56am UTC](https://forum.inductiveautomation.com/t/powertable-cell-border-color-on-tab-or-arrow-key/104266/3 "2025-03-31T05:56:06Z")

</div>

> [@jasongrant15](#):
>
> use the configurecell functionality

`configureCell` has a `selected` argument that does follow the arrowing, so if you're saying that you want the currently selected cell to have a thick border, the code would be written like this:

```python
#def configureCell(self, [...], colView):
	if selected:
		from javax.swing import BorderFactory
		borderColor = system.gui.color('red')
		border = BorderFactory.createMatteBorder(4, 4, 4, 4, borderColor)
		return {'background': self.selectionBackground, 'border': border}
	elif rowView % 2 == 0:
		return {'background': 'white'}
	else:
		return {'background': 'lightgrey'}

```

**Result:**

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/5/259416a6e668794ca5a28e677e49d2901ef800b2.png)

However, custom properties would be needed if you are wanting the initially clicked cell to get a border and retain it while arrowing around the table.

**Example:**  
_add custom properties for clicked cells_

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/7/2720c7f979cc467cada5f0c7bcdc091c21485152.png)

Store the values using the `onMouseClick` _ **extension function** _:

```python
#def onMouseClick(self, [...], event):
	self.clickedRow = rowIndex
	self.clickedColumn = colIndex
	self.repaint() # This is needed to make configure cell repaint the entire table

```

**Note:** _This is the **extension function** and not the event handler. The event handler won't register the clicked event in the inner table_

Clear the selected values when appropriate using the `propertyChange` event handler:

```python
if event.propertyName in ['selectedRow', 'selectedColumn'] and event.newValue == -1:
	event.source.clickedRow = -1
	event.source.clickedColumn = -1
	event.source.repaint() # Trigger configureCell extension function

```

Finally, in the `configureCell` extension function:

```python
#def configureCell(self, [...], colView):
	if rowIndex == self.clickedRow and colIndex == self.clickedColumn:
		from javax.swing import BorderFactory
		borderColor = system.gui.color('red')
		border = BorderFactory.createMatteBorder(4, 4, 4, 4, borderColor)
		if selected:
			return {'background': self.selectionBackground, 'border': border}
		else:
			return {'border': border}
	elif selected:
		return {'background': self.selectionBackground}
	elif rowView % 2 == 0:
		return {'background': 'white'}
	else:
		return {'background': 'lightgrey'}

```

**Result:** _after clicking cell (2, 1) and arrowing to cell (1, 2)_

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/3/e3dd7da890a3b09166f10d508c1124122e7f4a5c.png)
