Expand my Community achievements bar.

Resize width of Column in a Table

Avatar

Level 2

Is it possible to resize the width of a column in a table?

I currently have a form with a table in it that spans the entire width of the page.  What I want to do is, when a button is clicked, have one of the columns shrink in width so that there is room for a new column to be added to the table.  I have tried the following code to a button in the form:

form1.quoteTable.Table.Header.Cell3.w = 2.1993;

but it currently has no effect when I click it.

The table starts with  6 columns, has a header and a footer.  The footer has two columns (five of the columns are merged in the footer).

Any assistance is appreciated.

2 Replies

Avatar

Level 7

Yes, you can resize column widths but the first thing you have to know about tables is that each cell does NOT have a w property for the width. Column widths are defined at the table lvl. So if you have 6 columns, in the XML you'll have a statements that looks something like:

<subform name="Table1" layout="table" columnWidths="30mm 30mm 30mm 30mm 30mm 30mm" x="34.925mm" y="22.225mm">

You can change them in the click event of a button with:

Table1.columnWidths = "30mm 30mm 2in 30mm 30mm 30mm";

The script will accept values in either inches (in) or millimeters (mm).

Avatar

Level 2

That worked.  Thank you very much.

Here is what I used to, exactly, to get it to work:

//On click

form1.quoteTable.Table.columnWidths = "0.586in 2.1993in 1.036in 0.5433in 1.0954in 1.2652in";