The FlexGrid has a columnLayout property that gets or sets a JSON string containing a list of grid columns and their properties.
This sample uses the columnLayout property to persist the column layout to the browser's localStorage using the following code:
// save or restore column layout in localStorage
saveColumnLayout() {
if (localStorage) {
localStorage['columns'] = this.flex.columnLayout;
console.log('**LAYOUT: ' + this.flex.columnLayout);
}
}
loadColumnLayout() {
if (localStorage) {
this.flex.columnLayout = localStorage['columns'];
}
}
To see how this works, follow these steps: