undefined

Table#createViewModel derives the view model that is applied onto markup. It is called on the table instance with Column instances, and returns a TableViewModel.

Usage


Table#createViewModel: (columns, options) => TableViewModel

columns is an array of Column instances returned from Table#createColumns.

options is an optional configuration object to configure the view model.

const table = createTable(data);
const columns = table.createColumns(...);
const viewModel = table.createViewModel(columns);
const {
  headerRows,
  rows,
  tableAttrs,
  tableBodyAttrs,
} = viewModel;

options.rowDataId?: (item, index) => string

Defines a custom dataId for each row.

WARNING

In the context of sub-rows, the index of the first sub-row is 0.

Defaults to the item index.