# Class TableLayout

GoJS® Diagramming Components
version 3.0.14
by Northwoods Software®

This is an extension and not part of the main GoJS library. Note that the API for this class may change at any time. If you intend to use an extension in production, you should copy the code to your own source directory. See the Extensions intro page for more information.

#### Hierarchy

- Layout
  - TableLayout

This go.Layout positions non-Link Parts into a table according to the values of go.GraphObject.row, go.GraphObject.column, go.GraphObject.rowSpan, go.GraphObject.columnSpan, go.GraphObject.alignment, go.GraphObject.stretch. If the value of GraphObject.stretch is not go.Stretch.None, the Part will be sized according to the available space in the cell(s).

You can specify constraints for whole rows or columns by calling getRowDefinition or getColumnDefinition and setting one of the following properties: go.RowColumnDefinition.alignment, go.RowColumnDefinition.height, go.RowColumnDefinition.width, go.RowColumnDefinition.maximum, go.RowColumnDefinition.minimum, go.RowColumnDefinition.stretch.

The defaultAlignment and defaultStretch properties apply to all parts if not specified on the individual Part or in the corresponding row or column definition.

At the current time, there is no support for separator lines (go.RowColumnDefinition.separatorStroke, go.RowColumnDefinition.separatorStrokeWidth, and go.RowColumnDefinition.separatorDashArray properties) nor background (go.RowColumnDefinition.background and go.RowColumnDefinition.coversSeparators properties). There is no support for go.RowColumnDefinition.sizing, either.

If you want to experiment with this extension, try the Table Layout sample.

#####
Index

### Constructors

constructor

### Accessors

columnCount
defaultAlignment
defaultStretch
rowCount

### Methods

afterArrange
beforeMeasure
cloneProtected
doLayout
findColumnForDocumentX
findRowForDocumentY
getColumnDefinition
getLayoutBounds
getRowDefinition

#####
Inherited Index

### Accessors

Layout.arrangementOrigin
Layout.boundsComputation
Layout.diagram
Layout.group
Layout.isInitial
Layout.isOngoing
Layout.isRealtime
Layout.isRouting
Layout.isValidLayout
Layout.isViewportSized
Layout.network

### Methods

Layout.collectParts
Layout.commitLayout
Layout.copy
Layout.createNetwork
Layout.initialOrigin
Layout.invalidateLayout
Layout.makeNetwork
Layout.updateParts

## Constructors

### constructor

- new TableLayout(init?: Partial<TableLayout>): TableLayout

- #### Parameters

  - ##### `Optional` init: Partial<TableLayout>

  #### Returns TableLayout

## Accessors

### `Readonly` columnCount
: number

- This read-only property returns the number of columns in this TableLayout. This value is only valid after the layout has been performed.

### defaultAlignment
: Spot

- Gets or sets the alignment to use by default for Parts in rows (vertically) and in columns (horizontally).

  The default value is go.Spot.Default. Setting this property does not raise any events.

### defaultStretch
: Stretch

- Gets or sets whether Parts should be stretched in rows (vertically) and in columns (horizontally).

  The default value is go.Stretch.Default. Setting this property does not raise any events.

### `Readonly` rowCount
: number

- This read-only property returns the number of rows in this TableLayout. This value is only valid after the layout has been performed.

## Methods

### `Protected` `Virtual` afterArrange

- afterArrange(parts: List<Part>, rowcol: any[][][]): void

- Override this method in order to perform some operations after arranging. By default this method does nothing.

  #### Parameters

  - ##### parts: List<Part>

  - ##### rowcol: any[][][]

  #### Returns void

### `Protected` `Virtual` beforeMeasure

- beforeMeasure(parts: List<Part>, rowcol: any[][][]): void

- Override this method in order to perform some operations before measuring. By default this method does nothing.

  #### Parameters

  - ##### parts: List<Part>

  - ##### rowcol: any[][][]

  #### Returns void

### `Override` cloneProtected

- cloneProtected(copy: TableLayout): void

- Copies properties to a cloned Layout.

  #### Parameters

  - ##### copy: TableLayout

  #### Returns void

### `Override` doLayout

- doLayout(coll: Iterable<Part>): void

- This method performs the measuring and arranging of the table, assiging positions to each part.

  #### Parameters

  - ##### coll: Iterable<Part>

    A collection of go.Parts.

  #### Returns void

### findColumnForDocumentX

- findColumnForDocumentX(x: number): number

- Returns the cell at a given x-coordinate in document coordinates. This information is only valid when this layout has been performed and go.Layout.isValidLayout is true.

  If the point is to left of the column 0, this method returns -1. If the point to to the right of the last column, this returns the last column + 1.

  #### Parameters

  - ##### x: number

  #### Returns number

  a zero-based integer

  `see`

  findRowForDocumentY

### findRowForDocumentY

- findRowForDocumentY(y: number): number

- Returns the row at a given y-coordinate in document coordinates. This information is only valid when this layout has been performed and go.Layout.isValidLayout is true.

  If the point is above row 0, this method returns -1. If the point below the last row, this returns the last row + 1.

  #### Parameters

  - ##### y: number

  #### Returns number

  a zero-based integer

  `see`

  findColumnForDocumentX

### getColumnDefinition

- getColumnDefinition(idx: number): RowColumnDefinition

- Gets the go.RowColumnDefinition for a particular column in this TableLayout. If you ask for the definition of a column at or beyond the columnCount, it will automatically create one and return it.

  #### Parameters

  - ##### idx: number

    the non-negative zero-based integer column index.

  #### Returns RowColumnDefinition

### `Override` getLayoutBounds

- getLayoutBounds(part: Part, rect?: Rect): Rect

- Interpret go.Part.margin differently than normal.

  #### Parameters

  - ##### part: Part

  - ##### `Optional` rect: Rect

  #### Returns Rect

### getRowDefinition

- getRowDefinition(idx: number): RowColumnDefinition

- Gets the go.RowColumnDefinition for a particular row in this TableLayout. If you ask for the definition of a row at or beyond the rowCount, it will automatically create one and return it.

  #### Parameters

  - ##### idx: number

    the non-negative zero-based integer row index.

  #### Returns RowColumnDefinition

Copyright © 1998-2024 by Northwoods Software Corporation.