Persist States
To activate the save table states feature, specify the
when instantiating table controller.
controller = PanemuTableController .create<People>(
this.columns,
this.datasource,
{ stateKey: 'PersistStateComponent' });
The stateKey
should be unique app-wide to avoid collition. By default it is saved to browser's local storage.
Try to change the following states on below example:
- Resize columns width. Or click the cog button at the top right corner to change columns visibility, position and stickiness.
- Click some row headers to sort.
- Specify search criteria and grouping.
- Change the pagination range/page.
Then go to other page and back. The last states should be restored.
If columns structure changes (columns added, removed or there is a change in
children) the saved state is ignored. See
ColumnType.GROUP .
TableState.structureKey
By default the states are stored in browser's local storage. If you want to store it in database server, in your
.PanemuTableService.saveTableState()
. Should returnsPanemuTableService.getTableState() Observable<
.TableState >
. Should returnsPanemuTableService.deleteTableState() Observable
. By default, after the delete succeed, the page is reloaded.
Persisting state is best combined with
. It provides a button to clear or reset the state. To delete the states programmatically, call
. The controller also has saveState()
method.