Power Table Auto Resize Column Not Working as Expected

Hello all,

I just wanted to see if anyone has ran into this issue regarding their Power Table and how you and your team worked around it.

Essentially, I have a Power Table that has a custom script on the "propertyChange" event. This Power Table's "Data" property is indirectly binded to a memory tag of type Dataset called "Contact List". This memory tag is just hand typed contact information for my operators to easily find.

The Data property is indirectly binded as so:

[default]{1}/Contact List

Where {1} is:

Root Container.SiteName

When an operator clicks on a "Contact" button on an HMI Screen, the button triggers a custom script on the "actionPerformed" where it opens the Popup window that contains my Power Table and passes the "SiteName" to the Root Container which fills the {1} from the indirect binding above.

The problem is that the TableUtils.autoResizeAllColumns() method doesn't seem to be auto resizing properly. For some sites, the email column will perfectly fill the table and will be able to show the full emails of long emails. For other sites, some emails will be cut short such as test_email@test.c... AND will leave empty space after the Email column. Note: The Email column is the last column in the table.

The only current "workaround" or rather compromise, is to just have the operators manually drag the "Email" column to fill up the entire table and expand it for every site that has this bug. I have used the script provided by paul-griffith from this forum here and my own below but to no avail.

if event.propertyName == 'data':
	#This code resizes a wide table with the horizontal scroll bar
	from com.jidesoft.grid import TableUtils
	from javax.swing import JTable
	
	powerTable = event.source
	print powerTable
	
	def resizeTable():
		jTable = powerTable.getTable()
		jTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF)
		TableUtils.autoResizeAllColumns(jTable)
	system.util.invokeLater(resizeTable)

I am pretty new to Ignition (about 2 months of experience) so any help would be much appreciated :slight_smile:

I just decided to use AUTO_RESIZE_ALL_COLUMNS instead and made the width of the table long enough to fit the longest email I know of in each Memory Tag. If you do want your Power Table set at a locked width and you want the horizontal scrollbar at the same time, then try the same AUTO_RESIZE_OFF but I am still not sure if you will run into the issue where there is an empty space right after the last column and your string being cut off.

You can read more about JTables and all of its methods through this doc provided by Oracle.