Persist States
To activate the save table states feature, specify the when instantiating table controller.
controller = PanemuTableController .create<People>(
this.columns,
this.datasource,
{ saveState: {
key:'this_key_must_be_unique_app_wide',
//leave states undefined to save all states. To only save, for example,
// which columns are sorted and column position, use ['sorting', 'columns']
states: undefined
}
});The saveState.key 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 and select Setting 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. SeeColumnType.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.

