Open GuyShaanan opened 2 years ago
I recently came across this issue too and haven't found a solution yet.
+ const updatedColumns = props.columns?.map(propColumnObj => {
+ const { name } = propColumnObj;
+ const stateColumnObj = this.state.columns.find(columnObj => columnObj.name === name);
+ if (stateColumnObj == undefined) return propColumnObj;
+ propColumnObj['options'].display = stateColumnObj['display'];
+ return propColumnObj;
+ });
let { columns, filterData, filterList, columnOrder } = this.buildColumns(
- props.columns,
+ updatedColumns,
this.state.columns,
this.options.columnOrder,
this.state.columnOrder,
);
I'll try to find some time during the weekend to look at the repo and find a suitable solution. So far, this hack is working fine for me.
storageKey
to persist the table state.display: 'false'
(in the repo: the 'title' column)Expected Behavior
Current Behavior
Steps to Reproduce (for bugs)
https://codesandbox.io/s/muidatatables-persist-table-bug-kcrqyu
Your Environment
With very shallow reading of the source code, it seems like
setTableData
always passesprops.columns
instead of checkingthis.state.columns
, which holds the stored state.and
manually changing this piece of code seems making this bug fixed, but I really didn't checked more complex cases.