Is it possible to “auto size all columns” of a power table via scripting? I can right click on a table and click this option in a popup, but using powerTable.autoResizeMode = 4 or changing auto resize mode to “all columns” does not work for me because I have a screen with a lot of small power tables with pretty dynamic data where the column widths need to change with updated data. So I would like to be able to do the same action that the popup click does, but do it every time I query new data. Thanks in advance!
This is great but one followup question,
I have some tables that have 100 columns and I cant fit them in one page so I have to Turn off the Auto resize mode and that adds a horizontal scroll bar to my table that way all the columns can fit and look good. is he following enough to make sure when the window opens all the column auto resize while the auto resize mode stays off?
Woulnt the second one basically auto resize everything and then at the end it turns the auto resize mode to off and give me the look I want or are there two basically do the same thing?
I’m confused… I tested different versions of my script on a buttons actionPerformed event and it worked like a charm, anytime I change the column sized and click the button all the columns resize how they should BUT if I use the same script on visionWIndowOpened event handler of that Window it doesn’t work… Am I doing something wrong?
I tried different ways of this script that’s why you see the hashtags
from com.jidesoft.grid import TableUtils
from javax.swing import JTable
table = system.gui.getParentWindow(event).getComponentForPath('Root Container.Table').getTable()
#table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS)
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF)
TableUtils.autoResizeAllColumns(table)
#system.gui.getParentWindow(event).getComponentForPath('Root Container.Table').autoResizeMode = 0
This script on the propertyChange even of the table worked fine. if event.propertyName == "data"
When the window opens for a sec you see the one column not being resized and then when the tables propertyChange applies the column is resized…
I could do the same thing on the propertyChange event handler of the windows as well correct? I just have can’t use event and have to point to the table right?
Curious what I may be missing. I had the same issue with length of a table so I tried your code and couldn’t get it to work. Its on a property change of a text box so when the user selects the text box which in turn changes the query the event occurs. Though when I try the original code in this thread that works fine yet like the problem you had it was scrunched
from com.jidesoft.grid import TableUtils
from javax.swing import JTable
table = system.gui.getParentWindow(event).getComponentForPath(‘Root Container.Power Table’).getTable()