Controlling table rendering

Table rendering can be controlled by the use of presentation styles and table attributes.

Table width

By default, the width of a TABLE container is defined by the number of visible columns in its layout.
Note: Table column fields defined as HIDDEN will not contribute to computing the default table width.

In this example, the table is defined with three visible columns, which in turn define individual field widths. The sum of the field widths defines the default table width.

GRID
{
<TABLE t1           >
[c1  |c2       |c3  ]
...
To specify explicitly the width of a table, use the WIDTH attribute:
TABLE t1 : table1, WIDTH = 5 COLUMNS, ... ;
Note: The COLUMNS unit means a number of fields/columns in the TABLE, not grid-columns.

Table height

The height of a TABLE container is by default defined by the number of rows in its layout. In the example, the default table height will be three rows:
GRID
{
<TABLE t1           >
[c1  |c2       |c3  ]
[c1  |c2       |c3  ]
[c1  |c2       |c3  ]
<                   >
...
To specify explicitly the height of a table, use the HEIGHT attribute:
TABLE t1 : table1, HEIGHT = 10 LINES, ... ;
Note: The LINES unit means a number of lines in the TABLE, not grid-lines.

Defining a table with fixed height

By default, tables can be resized in height and behave as a stretchable element in the graphical window.

Use the WANTFIXEDPAGESIZE form file attribute to prevent table resizing:
TABLE t1 : table1, WANTFIXEDPAGESIZE, ... ;

Current row / current cell rendering

In a TABLE container, the highlighting of the current row (or current cell, when focus granularity is at the cell level) can be controlled with style attributes.

Note: The current row / current cell style attributes apply also to stretchable SCROLLGRID containers.

For more details, see Row and cell highlighting in TABLE.

Making table columns unmovable

When the Table style attribute tableType is set to frozenTable, you can define a number of fixed columns on the left and right, respectively with the leftFrozenColumns and rightFrozenColumns style attributes:
<Style name="Table.custom_style">
  <StyleAttribute name="tableType" value="frozenTable"/>
  <StyleAttribute name="leftFrozenColumns" value="2"/>
  <StyleAttribute name="rightFrozenColumns" value="1"/>
</Style>
Note: With some front-ends (GBC), frozen columns can also be used in Treeviews.

See the reference topics Table style attributes, Tree style attributes.

Mobile-style list view rendering

TABLE containers can be rendered with a mobile list view look and feel, by setting the tableType style attribute to "listView":
<Style name="Table.custom_style">
  <StyleAttribute name="tableType" value="listView"/>
</Style>

For the complete list of style attributes, see Table style attributes.

Current row visibility after dialog execution

When the dialog controlling the table has finished, the current row may be deselected, depending on the KEEP CURRENT ROW dialog attribute.