Shared: Table: fix

This commit is contained in:
Viktor Fomin 2024-07-30 10:33:59 +03:00
parent 308ebd2d8d
commit d0d03ccd33

View File

@ -86,6 +86,14 @@ class TableHeaderComponent extends React.Component<
? localStorage.getItem(columnInfoPanelStorageName)
: localStorage.getItem(columnStorageName);
if (sortBy !== prevProps.sortBy || sorted !== prevProps.sorted) {
const columnIndex = columns.findIndex((c) => c?.sortBy === sortBy);
if (columnIndex > -1 && !columns[columnIndex].enable) {
columns[columnIndex].onChange?.(columns[columnIndex].key);
}
}
// columns.length + 1 - its settings column
if (storageSize && storageSize.split(" ").length !== columns.length + 1) {
return this.resetColumns();
@ -98,15 +106,6 @@ class TableHeaderComponent extends React.Component<
}
}
if (sortBy !== prevProps.sortBy || sorted !== prevProps.sorted) {
const columnIndex = columns.findIndex((c) => c?.sortBy === sortBy);
if (columnIndex === -1) return;
if (!columns[columnIndex].enable) {
columns[columnIndex].onChange?.(columns[columnIndex].key);
}
}
this.onResize();
}