# Power table column width auto ajust?

**URL:** <https://forum.inductiveautomation.com/t/power-table-column-width-auto-ajust/20944>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [November 19, 2018, 4:52pm UTC](https://forum.inductiveautomation.com/t/power-table-column-width-auto-ajust/20944 "2018-11-19T16:52:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [November 19, 2018, 4:52pm UTC](https://forum.inductiveautomation.com/t/power-table-column-width-auto-ajust/20944/1 "2018-11-19T16:52:16Z")

</div>

I’m looking for a way to auto adjust power table’s columns width according column text contents

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [November 19, 2018, 6:19pm UTC](https://forum.inductiveautomation.com/t/power-table-column-width-auto-ajust/20944/2 "2018-11-19T18:19:49Z")

</div>

> [@Cell color in Power table with configureCell and column widths](http://forum.inductiveautomation.com/t/cell-color-in-power-table-with-configurecell-and-column-widths/15526):
>
> I have a boolean column that I want to change the color of that cell based on its value (and if possible change the text) and I can’t seem to get it working. This was easy with a regular table using the Translate List and Background Color List attributes. In my power table, I tried this under configureCell: if colName == "Pass" and value == 1: return {'Text': 'Pass','background': system.gui.color(0, 255, 0)} else: return {'Text': 'Fail','background': system.gui.color(255, 0, 0)} and nothing …

There is a post towards the bottom that might help you out.

---

<div class="post-metadata">

**Author:** ![mcgheeiv](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@mcgheeiv](https://forum.inductiveautomation.com/u/mcgheeiv)\
**Post date:** [November 21, 2018, 10:47am UTC](https://forum.inductiveautomation.com/t/power-table-column-width-auto-ajust/20944/3 "2018-11-21T10:47:08Z")

</div>

I found this posted on the forum awhile ago (not mine, credit goes elsewhere) and put it in the table’s property change script. Perhaps it will lead you in the right direction:

```auto
if event.propertyName == 'data':
 	from com.jidesoft.grid import TableUtils
 	from javax.swing import JTable
 	table = event.source.parent.getComponent('Power Table').getTable()
 	
 	table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS)
 	TableUtils.autoResizeAllColumns(table)

```
