State persistence refers to the TreeGrid’s state maintained in the browser’s localStorage
even if the browser is refreshed or if you move to the next page within the browser.
State persistence stores treegrid’s model object in the local storage when the enablePersistence
is defined as true.
If the enablePersistence
property is set to true, the treegrid property value is saved in the window.localStorage for reference. You can get/set the localStorage value by using the getItem/setItem method in the window.localStorage.
// get the TreeGrid model.
const value: string = window.localStorage.getItem('treegridTreeGrid') as string;
// "treegridTreeGrid" is component name + component id.
const model: object = JSON.parse(value);
// set the TreeGrid model.
// "treegridTreeGrid" is component name + component id.
window.localStorage.setItem('treegridTreeGrid', JSON.stringify(model));
You can refer to our
React Tree Grid
feature tour page for its groundbreaking feature representations. You can also explore ourReact Tree Grid example
to knows how to present and manipulate data.