Class AutoRestoreOptions<T>

Defaults for TableOptionsIf.autoRestoreOptions: everything off. Spread it and switch on what the table should remember in localStorage (one key per table) – see AutoRestoreOptionsIf for all flags.

Example

const tableOptions: TableOptionsIf = {
...new TableOptions(),
autoRestoreOptions: {
...new AutoRestoreOptions<Order>(),
getStorageKeyFn: () => "orders-table", // unique per table
autoRestoreSortingState: true,
autoRestoreScrollPosition: true,
autoRestoreColumnLayout: true // widths, order, visibility (since 1.1.92)
}
};

Example

// trees: remember expanded nodes – needs a stable id per node
const treeOptions: TableOptionsIf = {
...new TableOptions(),
autoRestoreOptions: {
...new AutoRestoreOptions<OrderNode>(),
getStorageKeyFn: () => "order-tree",
getRowId: (node: OrderNode) => node.id,
autoRestoreCollapsedExpandedState: true
}
};

See

Training: Remember the state

Type Parameters

  • T

Hierarchy

  • AutoRestoreOptions

Implements

Constructors

Properties

autoRestoreCheckedState: boolean = false

Remember the checked rows (by getRowId). Since 1.1.92 (before: declared without effect).

autoRestoreCollapsedExpandedState: boolean = false

Remember expanded and collapsed nodes of a tree table (by getRowId).

autoRestoreColumnLayout: boolean = false

Since

1.1.92

autoRestoreCustomState: boolean = false

Since

1.1.92

autoRestoreDetailState: boolean = false

Since

1.1.97

autoRestoreHeaderGroupState: boolean = false

Since

1.1.92

autoRestoreScrollPosition: boolean = false

Remember the scroll position (and the id of the first visible row).

autoRestoreSelectedState: boolean = false

Remember the selection: rows by getRowId, columns by property. Restored in the current row order. Since 1.1.92 (before: declared without effect).

autoRestoreSortingState: boolean = false

Remember the sorted columns (by property).

getRowId: ((row) => string | number) = ...

A unique, stable id per row (tree: per node). With the default of AutoRestoreOptions the table uses the property id, then uuid; rows without them are not stored (since 1.1.92 – the JSON of the row would write personal data into the storage; the table warns once).

Type declaration

    • (row): string | number
    • Default: the property id, then uuid, then the JSON of the row. The table itself uses only id / uuid of this default (since 1.1.92): rows without them are not stored – the JSON would write whole rows into the storage.

      Parameters

      • row: T

      Returns string | number

getStorageKeyFn: undefined = undefined

The storage key of this table, e.g. () => "orders". Without it nothing is stored.

Methods