Skip to content

Commit

Permalink
#646: initial show/hide grid display
Browse files Browse the repository at this point in the history
  • Loading branch information
aschonfeld committed Mar 15, 2022
1 parent 54f3b4b commit 5d54c82
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions frontend/static/popups/describe/DtypesGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,18 @@ const DtypesGrid: React.FC<DtypesGridProps & WithTranslation> = ({
setVisibility,
}) => {
const [sort, setSort] = React.useState<SortDef>(['index', SortDir.ASC]);
const [data, setData] = React.useState<DtypesGridRow[]>(
dtypes.map((col, index) => ({ ...col, selected: selected ? selected.index === col.index : index === 0 })),
);
const [data, setData] = React.useState<DtypesGridRow[]>([]);
const [dtypesFilter, setDtypesFilter] = React.useState<string>();
const [allVisible, setAllVisible] = React.useState(gu.noHidden(dtypes));

React.useEffect(() => {
setData(data.map((row) => ({ ...row, selected: selected ? selected.index === row.index : row.selected })));
}, [selected]);

React.useEffect(() => {
setData(dtypes.map((col, index) => ({ ...col, selected: selected ? selected.index === col.index : index === 0 })));
}, [dtypes]);

const headerRenderer = (props: TableHeaderProps): JSX.Element => {
const { dataKey, label } = props;
if (dataKey === 'visible') {
Expand Down

0 comments on commit 5d54c82

Please sign in to comment.