Search results

Get or Set Local Storage Value in JavaScript (ES5) Grid control

08 May 2023 / 1 minute to read

If the enablePersistence property is set to 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 the 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.