Search results

Get or Set Local Storage Value in Angular Grid component

24 May 2022 / 1 minute to read

If the enablePersistence property set as true, The Grid property value is saved in the window.localStorage for reference. You can get/set the localStorage value by using the getItem/setItem method in window.localStorage.

Copied to clipboard
//get the Grid model.
let value: string = window.localStorage.getItem('gridGrid'); //"gridGrid" is component name + component id.
let model: Object = JSON.parse(model);
Copied to clipboard
//set the Grid model.
window.localStorage.setItem('gridGrid', JSON.stringify(model)); //"gridGrid" is component name + component id.