feat: allow adding available pre-defined table columns to views (#1371)
* feat: allow adding available pre-defined table columns to views Closes #1360 * fix: allow creating views with the same name for the same table * refactor: code review - rename things - move handleColumnVisibilityChange to useTableColumns hook
This commit is contained in:
@ -148,19 +148,6 @@ export function EntityTableHeader() {
|
||||
setIsColumnMenuOpen((previousValue) => !previousValue);
|
||||
}, []);
|
||||
|
||||
const handleAddColumn = useCallback(
|
||||
(columnId: string) => {
|
||||
setIsColumnMenuOpen(false);
|
||||
|
||||
const nextColumns = columns.map((column) =>
|
||||
column.id === columnId ? { ...column, isVisible: true } : column,
|
||||
);
|
||||
|
||||
setColumns(nextColumns);
|
||||
},
|
||||
[columns, setColumns],
|
||||
);
|
||||
|
||||
return (
|
||||
<thead data-select-disable>
|
||||
<tr>
|
||||
@ -204,7 +191,7 @@ export function EntityTableHeader() {
|
||||
/>
|
||||
{isColumnMenuOpen && (
|
||||
<StyledEntityTableColumnMenu
|
||||
onAddColumn={handleAddColumn}
|
||||
onAddColumn={toggleColumnMenu}
|
||||
onClickOutside={toggleColumnMenu}
|
||||
/>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user