Client: Home: TableHeader: show column after sorting in accounts

This commit is contained in:
Viktor Fomin 2024-07-12 15:44:39 +03:00
parent a1e9e0b507
commit 842a6e1fa4

View File

@ -118,6 +118,18 @@ class PeopleTableHeader extends React.Component {
this.state = { columns, resetColumnsSize };
}
componentDidUpdate(prevProps) {
const { filter } = this.props;
const { columns } = this.state;
if (filter.sortBy !== prevProps.filter.sortBy) {
const columnIndex = columns.findIndex((c) => c?.sortBy === filter.sortBy);
if (columnIndex === -1) return;
!columns[columnIndex].enable &&
columns[columnIndex].onChange?.(columns[columnIndex].key);
}
}
onColumnChange = (key, e) => {
const { columns } = this.state;
const columnIndex = columns.findIndex((c) => c.key === key);