Skip to content

Commit

Permalink
Merge pull request #114 from Loxeris/fix_datatable_size
Browse files Browse the repository at this point in the history
fix: DataTable with fixed size
  • Loading branch information
aldbr authored Apr 11, 2024
2 parents 9766918 + 2ce94a4 commit 5a168f7
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/components/ui/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -550,12 +550,6 @@ export function DataTable(props: DataTableProps) {
);
}

// Calculate the number of empty rows needed to fill the space
const emptyRows = Math.min(
25,
rowsPerPage - Math.min(rowsPerPage, rows.length - page * rowsPerPage),
);

return (
<Box sx={{ width: "100%" }}>
<FilterToolbar
Expand All @@ -572,12 +566,12 @@ export function DataTable(props: DataTableProps) {
selectedIds={selected}
toolbarComponents={toolbarComponents}
/>
<TableContainer sx={{ maxHeight: "55vh" }}>
<TableContainer sx={{ height: "55vh" }}>
<Table
stickyHeader
sx={{ minWidth: isMobile ? "undefined" : "50vw" }}
aria-labelledby="tableTitle"
size={"medium"}
size={"small"}
>
<DataTableHead
headCells={columns}
Expand Down Expand Up @@ -633,11 +627,6 @@ export function DataTable(props: DataTableProps) {
</TableRow>
);
})}
{emptyRows > 0 && (
<TableRow style={{ height: 53 * emptyRows }}>
<TableCell colSpan={columns.length + 1} />
</TableRow>
)}
</TableBody>
</Table>
</TableContainer>
Expand Down

0 comments on commit 5a168f7

Please sign in to comment.