Interface CreateTableModelPara

Parameters of TableFactory.createTableModel – pass any subset (Partial<CreateTableModelPara>).

Three typical combinations:

You have … Pass Training
an array of objects rows (+ properties or columnDefs) chapter 12, 13
rows of values (CSV, matrix) headerData, bodyData, footerData, columnSizes chapter 14
own area models headerAreaModel, bodyAreaModel, footerAreaModel + columnDefs chapter 15–17

Everything not given is derived: column definitions from properties or the keys of the first row (header label = key in upper case, width 200 px), area models from the data, row heights from tableOptions.defaultRowHeights.

Example

const tableModel = TableFactory.createTableModel({
rows: orders, // Order[]
columnDefs: [new ColumnDef("id", "ID", px80, allRight), new ColumnDef("customer", "Customer", px180)],
fixedLeftColumnCount: 1,
tableOptions
});

Hierarchy

  • CreateTableModelPara

Properties

bodyAreaModel: AreaModelIf

Model of the body. Default: built from rows (objects or tree rows) or bodyData. See AreaModel for own models.

bodyData: any[][]

The body as rows of values (any[][]).

columnCount: number

Number of columns. Default: derived from columnDefs, headerData or columnSizes.

columnDefs: ColumnDefIf[]

The columns: property, header label, width, classes, renderers, sorting, editing. See ColumnDef.

columnLetters: boolean

Column letters A, B, … as an extra header row above the header labels (like a spreadsheet; for cell formulas, TableOptionsIf.cellFormulas). A click on a letter selects the column (selection type "range"). Row number and checkbox columns get no letter. Only with the default header (labels or headerData).

Example

const tableModel = TableFactory.createTableModel({ rows, columnDefs, rowNumbersVisible: { mode: "original" }, columnLetters: true });

Since

1.1.99

columnSizes: number[]

Column widths in px – the simple alternative to columnDefs (e.g. with bodyData).

defaultRowHeights: DefaultRowHeightsIf

Row heights of header, body and footer in px. Default: tableOptions.defaultRowHeights, otherwise 34 / 34 / 34.

fixedLeftColumnCount: number

Number of columns fixed on the left (side "west"). Default 0.

fixedRightColumnCount: number

Number of columns fixed on the right (side "east"). Default 0.

footerAggregates: AggregateFooterConfig

A footer with totals that follow filter and sorting (AreaModelAggregateFooter): { total: "sum" } (one row – the key is the property of the column), [{ label, aggregates }, …] (several rows) or full AggregateFooterOptionsIf. Row height: defaultRowHeights.footer. Ignored with an own footerAreaModel (warning); footerData is ignored with it (warning).

Example

const tableModel = TableFactory.createTableModel({
rows: orders,
columnDefs,
footerAggregates: { quantity: "sum", total: "sum" } // footer: "100,000 rows" | … | 549,812 | 27,481,033.5
});

See

Live demo: totals & aggregation · Training: Totals in one option

Since

1.1.94

footerAreaModel: AreaModelIf

Model of the footer. Default: footerAggregates, footerData, otherwise no footer.

footerData: string[][]

Footer rows as values (static – they don't follow filter or edits).

getSelectionModel: GetT<SelectionModelIf>

Selection model factory. Default: tableOptions.getSelectionModel.

headerAreaModel: AreaModelIf

Model of the header. Default: one header row from the headerLabels of columnDefs, or headerData.

headerData: string[][]

Header rows as values – several rows are possible.

overridingColumnWidth: number

A width in px for all columns; -1 (default) = use the column definitions.

parentSize: number

Width of the parent element in px, used for percentage column widths before the first render (default 400).

properties: string[]

Which properties of rows become columns, in this order (ignored if columnDefs is given).

rowCheckboxVisible: boolean

Show a checkbox column for every row. Default false.

rowDrag: boolean

Row drag: true puts a drag handle into the first data column (behind row numbers and checkboxes) – sets ColumnDefIf.rowDrag on that column definition. Options: TableOptionsIf.rowDragOptions. Default false.

Example

const tableModel = TableFactory.createTableModel({ rows: orders, rowDrag: true });

See

Live demo: row drag · Training: Dragging rows into order

Since

1.1.95

rowNumbersVisible: boolean | Partial<RowNumberOptionsIf>

Row numbers (1, 2, 3 …) in a column in front of all others, fixed on the left: true or options (RowNumberOptionsIf). Puts a RowNumberColumnDef in front of columnDefs and adds 1 to fixedLeftColumnCount; headerData/footerData get an empty cell in front. Default false.

The column is a real column: the indices of all other columns are one higher – use properties where you can (TableApi.getColumnIndex). With bodyData or own area models the flag is ignored (with a warning), because their columns would shift – put a RowNumberColumnDef into the column definitions of your models yourself.

Example

const tableModel = TableFactory.createTableModel({ rows: orders, columnDefs, rowNumbersVisible: true });

See

Live demo: row numbers · Training: Row numbers

Since

1.1.93

rows: any[]

The rows as objects (T[]) or tree rows from TreeFactory.buildTreeRows.

tableOptions: TableOptionsIf

Options of the table; the factory reads defaultRowHeights, getSelectionModel and showCheckboxWihoutExtraColumn.