Power Table columns widths

How can I adjust the widths of the columns in the power table?

For both the regular table and the power table, if you put the Designer into preview mode, when your mouse is between columns in the header you can change the column widths. When you’re happy with the layout, get out of preview mode and save. When you reopen the window (or open the project in the client), you’ll see your new column sizes.

1 Like

Thank you! Will it keep the column widths even with a restart?

Yes, it will.

This does not appear to be true any more as of Ignition 7.9. When I try this, at the point I switch back to Preview Mode it resets all the column widths.

There are multiple column resizing modes available. Try them.

Also look for a binding on the column attributes dataset property that might be overwriting your settings.

When I started programming in ignition, I was using version 7.9, and this power table behavior bothered me. In C#, I would simply programmatically specify the column widths for my datagridviews, and I was searching for how to do that with power tables the first time I encountered this post. I remember trying Kathy Applebaum's solution, and it worked. However, there seemed to be a lot things in the design environment that would reset the widths, and I do remember feeling frustrated by this many times.

That said, I still use a lot of power tables, and I don't seem to have the same level of frustration that I had starting out, so either the behavior has been improved in later versions, or I've just figured out how to work with them in a way that keeps the sizes right. In any case, I can tell you with confidence that version 7.9 should retain the column widths in the client the way they were when they were saved in the designer.

I have, and they are frustrating and poorly documented.

What specifically are you referring to?

There are no bindings on the column attributes.

The three methods I have tried so far:

  1. The method described in this post, which does not work as described for me. The columns always revert back to being equally spaced.

  2. <Power Table Object>.setColumnWidth(<column index>, <width in pixels>)
    This looked promising. It appears to work exactly as if you grabbed the slider by hand and moved it. I got it like I wanted in Designer, but it looks significantly different in the client application than it did in Designer.

  3. Copy the .defaultColumnView string after adjusting the columns the way I want them.
    This works when I set .defaultColumnView from a button, but I don't want the user to have to push a button to get the sizing correct. When I put the same code from the button in an event script such as on property change event script, it doesn't do anything. I could not find documentation for how this works or the weird format (is it tab-delimited?)

If the script works from a button, it should work from the parent window's internalFrameOpened event, but the relative context of the script will have to be changed in order for it to work. For example: anything that uses this from a button:event.source.parent.getComponent('Power Table')

will need to be changed to system.gui.getParentWindow(event).getComponentForPath('Root Container.Power Table') when being ran from a window script.

Here is the documentation:
Ignition 7.9: Component and Window Scripting