Powertable Column Width

Is there an easy way to set the column widths and have the widths save? I am not opposed to doing it in a script. For example, giving the template an array of numbers as a custom property then setting the column widths on the Initialize method?

Thanks in advanced,
christopher

What’s up Neech? ESE Alumni here…

I usually create a custom method on the power table, something like this:

# Set the column width for the table
self.setColumnWidth(0,60)
self.setColumnWidth(1,400)
self.setColumnWidth(2,60)
1 Like

Hey dude! Thanks for the response! I will try that.

Paullys50, Would you please show us exactly how this Custom Method is configured.
Thanks

once you create the custom method you have to call it for it to run. I’ve used this by calling the custom method from another component, but you can call it from the same component it’s in.
in the ColumnWidth function put something like

self.setColumnWidth(0,200)
self.setColumnWidth(1,100)
self.setColumnWidth(2,300)

to run it from another component just put in this script

event.source.parent.getComponent('Power Table').ColumnWidth()

calling the method from the same component use

event.source.ColumnWidth()

custom method link

1 Like

Thank you for your response.
I’m still having some trouble, will you take a look at what I have and see if anything stands out to you. What about the “Parameters” box?

I don’t see any issue here. The parameters box is if you want to pass a variable into the function. This function does not need a parameter passed into it to accomplish the set column width.

So if you wanted to make sure the column width is always correct you could apply this script to the propertyChange event.

if event.propertyName == 'data':
     event.source.ColumnWidth()

Lets say you use a custom method later on that you want to pass a value of a calculation into the custom method to do an error check or something you would do this from where ever you are performing the calculation

event.source.customMethod(calculation result)

This call passes the calculation result as a parameter into the custom method for validation. A custom method without a parameter is called with the parenthesis empty.

EDIT: Also set the table’s resize mode to off!