Persistence

Persistence works with AG Grid the same way as in other Dash components. For more information, see the persistence page. A grid must have an id to enable persistence.

Properties for Persistence (from the reference page)

persisted_props (list of strings; default ['selectedRows']): Properties whose user interactions will persist after refreshing the component or the page.

persistence (boolean | string | number; optional): Used to allow user interactions in this component to be persisted when the component - or the page - is refreshed. If persisted is truthy and hasn’t changed from its previous value, a value that the user has changed while using the app will keep that change, as long as the new value also matches what was given originally. Used in conjunction with persistence_type.

persistence_type (a value equal to: ‘local’, ‘session’, ‘memory’; default 'local'): Where persisted user changes will be stored: memory: only kept in memory, reset on page refresh. local: window.localStorage, data is kept after the browser quit. session: window.sessionStorage, data is cleared once the browser quit.

Persisted Selected Rows

Here is an example with selectedRows persisted. The selections persist when the page is refreshed.

Rows persisted

Persisted Filter Selection

In this example, we set the filterModel property for persistence. The user filter selections persist when the page is refreshed.

        dag.AgGrid(
            persistence=True,
            persisted_props=["filterModel"]
        ),

For more info on filterModel, see Filter Callbacks.

Filters persisted