'Ag-grid-react version 27 community applyColumnState does not work for me
I use onColumnResized={e => onSaveGridColumnState(e, 'active')} to save columns state in local storage like so:
const onSaveGridColumnState = (e, source: string): void => {
localStorage.setItem('status-columns-' + source, JSON.stringify(gridRef.current.columnApi.getColumnState()));
};
then on onFirstDataRendered :
const onFirstDataRendered = (e: FirstDataRenderedEvent, source: string): void => {
const cols = JSON.parse(localStorage.getItem('status-columns-' + source));
if (cols) {
const s = gridRef.current.columnApi.applyColumnState({
state: cols,
applyOrder: true,
});
}
};
In version 26 the user kept seeing the same columns width even after F5 on the browser. With 27 it does not remember the columns widths
What am I doing wrong?
Thank you!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
