Skip to content

Commit

Permalink
CDC #157 - Adjusting DataTableColumnSelector to not add columns no lo…
Browse files Browse the repository at this point in the history
…nger included in props
  • Loading branch information
dleadbetter committed May 13, 2024
1 parent 588f911 commit 6d3c746
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/semantic-ui/src/components/DataTableColumnSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,15 @@ const useColumnSelector = (WrappedComponent: ComponentType<any>) => (
};
}

// Iterate over the session columns to preserve the ordering
const columns = _.map(session.columns, (column) => ({
...(_.findWhere(props.columns, { name: column.name }) || {}),
...column
}));
const columns = [];

// Iterate over the session columns to preserve the ordering.
_.each(session.columns, (column) => {
const findColumn = _.findWhere(props.columns, { name: column.name });
if (findColumn) {
columns.push({ ...findColumn, ...column });
}
});

// Append any new columns not stored in the session
const columnNames = _.pluck(columns, 'name');
Expand Down

0 comments on commit 6d3c746

Please sign in to comment.