This is a default implementation of TableModelIf. Ths TableModel is on one hand a container for the header, body, and footer models (see : #getAreaModel, and #AreaModelIf), and on the other hand the master of the column information (#getColumnCount(), #getColumnWidth(columnIndex: number)).

If getFixedLeftColumnCount() returns a value greater than 0, a fixed west area will be rendered in the header, body, and footer. A value greater than 0 for getFixedLeftColumnCount() will result in the presence of an east area.

 +----------------+-------------------+--------------+
 |  header/west   |  header/center    | header/east  |
 +----------------+-------------------+--------------+
 |  body/west     |  body/center      | body/east    |
 +----------------+-------------------+--------------+
 |  footer/west   |  footer/center    | footer/east  |
 +----------------+-------------------+--------------+ 

Hierarchy

Implements

Constructors

  • Parameters

    Returns TableModel

Properties

bodyAreaModel: AreaModelIf
columnCount: number = 0
columnDefs: ColumnDefIf[] = []
columnSizes: number[] = []
contentHeightInPx: number = 0
contentWidthInPx: number = 0
defaultRowHeights: DefaultRowHeightsIf = ...
fixedLeftColumnCount: number = 0
fixedRightColumnCount: number = 0
footerAreaModel: AreaModelIf
footerVisible: boolean = true

false: the footer is hidden (height 0), see setFooterVisible.

getSelectionModel: GetT<SelectionModelIf> = ...
headerAreaModel: AreaModelIf
headerVisible: boolean = true

false: the header is hidden (height 0), see setHeaderVisible.

overridingColumnWidth: number = -1
padding: Padding = ...
parentSize: number = 400
rowCheckboxVisible: boolean = false
rowCount: number = 0
xPositions: number[] = []

Methods

  • Retrieves the property key of the table row business object associated with the specified column index. It's only available when columnDefs are specified.

    Parameters

    • columnIndex: number

      The index of the column to retrieve the property from.

    Returns string

    The property associated with the specified column index.

  • Returns the total width of the side area identified by sideIdent.

    Parameters

    • sideIdent: SideIdent

      The identifier of the side area ("west" | "center" | "east").

    Returns number

    • The total width in pixels of the side area.
  • Retrieves the start and end column indices based on the given side identifier.

    Parameters

    • sideIdent: SideIdent

      The side identifier, which can be "west", "east", or "center".

    Returns [number, number]

    • An array containing the start and end column indices.
  • Recalculates the height and padding for the body area.

    This method retrieves the area model for the "body" area, and updates the rowCount property with the row count of the model.

    The contentHeightInPx property is then updated with the height of the "body" area.

    The method calls the recalcContentWidthInPx() method to recalculate the content width.

    Finally, the method calls the recalcPadding() method to recalculate the padding.

    Returns void

  • Shows or hides a column. The column keeps its definition, position and width – a hidden column has the width 0 (getColumnWidth), is not rendered, copied or exported; showing it again restores its width.

    Works through ColumnDefIf.isVisible: it is replaced by TrueFn / FalseFn (an own isVisible function of the column is replaced, too). Columns without a column definition can't be hidden. With header groups (AreaModelCellGroups) the column is shown only if neither this method nor a collapsed group hides it – expanding the group does not bring back a column hidden here, and vice versa. Weight widths (new Size(1, "weight")) are shared among the shown columns. Recalculates the content width, the padding (fixed columns) and the x positions. Only changes the model – TableApi.setColumnVisible also repaints the table.

    Parameters

    • column: string | number | ColumnDefIf

      column index (fixed columns included), property or column definition

    • visible: boolean

      false hides the column

    Returns boolean

    false if there is no such column definition

    Example

    tableModel.setColumnVisible?.("category", false);
    
  • Sets the width in pixel of a column (by columnIndex) in a table. The width is also stored in the column's ColumnDef (width = the new px size), so it survives a host resize (the widths are recalculated from the ColumnDefs then).

    Parameters

    • columnIndex: number

      The index of the column.

    • width: number

      The desired width of the column.

    Returns void