Class SpreadsheetTableModel

The table model of a spreadsheet (SpreadsheetFactory): its data columns can be inserted and deleted (TableApi.insertColumns).

Since

1.1.99

Hierarchy

Constructors

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
sheetBody: AreaModelSheet
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.

  • 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

  • Sets the data columns: A… with the given widths (insert/delete columns keep the widths of the moved columns).

    Parameters

    • count: number

      data columns

    • Optional widths: number[] = []

      width per data column in px (missing: the default width)

    Returns void