trying taking out the hidePagination

This commit is contained in:
csawatzky 2025-04-10 11:52:53 -06:00
parent 9d3cd41d5f
commit b835524700
3 changed files with 14 additions and 18 deletions

View file

@ -66,11 +66,11 @@ export default function CableMounting(props: Props) {
rows={bin.CableSums} rows={bin.CableSums}
columns={columns} columns={columns}
page={0} page={0}
pageSize={0} pageSize={5}
handleRowsPerPageChange={()=>{}} handleRowsPerPageChange={()=>{}}
setPage={()=>{}} setPage={()=>{}}
total={0} total={0}
hidePagination //hidePagination
/> />
) )
} }

View file

@ -133,11 +133,11 @@ export default function CableTable(props: Props) {
columns={columns} columns={columns}
rows={cableData} rows={cableData}
page={0} page={0}
pageSize={0} pageSize={5}
total={0} total={0}
setPage={()=>{}} setPage={()=>{}}
handleRowsPerPageChange={()=>{}} handleRowsPerPageChange={()=>{}}
hidePagination //hidePagination
/> />
); );
} }

View file

@ -91,7 +91,7 @@ interface Props<T> {
selectedRows?: number[]; //which rows are selected will need to be controlled by the parent in order to keep track between page changes selectedRows?: number[]; //which rows are selected will need to be controlled by the parent in order to keep track between page changes
customElement?: JSX.Element //element that will be placed in the table head between the table actions and the column header rows customElement?: JSX.Element //element that will be placed in the table head between the table actions and the column header rows
mobileView?: boolean //can be used to force the table to use its mobile view for narrow containing elements ie, drawer mobileView?: boolean //can be used to force the table to use its mobile view for narrow containing elements ie, drawer
hidePagination?: boolean //when passed in will hide the pagination at the bottom of the table //hidePagination?: boolean //when passed in will hide the pagination at the bottom of the table
} }
export default function ResponsiveTable<T extends Object>(props: Props<T>) { export default function ResponsiveTable<T extends Object>(props: Props<T>) {
@ -120,7 +120,7 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
selectedRows, selectedRows,
customElement, customElement,
mobileView, mobileView,
hidePagination //hidePagination
} = props } = props
const classes = useStyles(); const classes = useStyles();
const columns = typeof(props.columns) === "function" ? props.columns() : props.columns const columns = typeof(props.columns) === "function" ? props.columns() : props.columns
@ -141,10 +141,6 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
return saved ? JSON.parse(saved) : []; return saved ? JSON.parse(saved) : [];
}); });
useEffect(()=>{
console.log("ResponsiveTable rows: " + rows.toString())
},[rows])
useEffect(() => { useEffect(() => {
localStorage.setItem(filterKey, JSON.stringify(filterList)); localStorage.setItem(filterKey, JSON.stringify(filterList));
}, [filterList]) }, [filterList])
@ -353,7 +349,7 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
</Card> </Card>
) )
})} })}
{/* {rows.length < 1 && {rows.length < 1 &&
(!isLoading ? (!isLoading ?
<Typography sx={{ textAlign: "center" }} color="textSecondary"> <Typography sx={{ textAlign: "center" }} color="textSecondary">
{ noDataMessage ? noDataMessage : "No data."} { noDataMessage ? noDataMessage : "No data."}
@ -363,7 +359,7 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
<CircularProgress/> <CircularProgress/>
</Box> </Box>
) )
} */} }
</Box> </Box>
) )
@ -427,7 +423,7 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
<TableRow sx={ hideKeys ? { display: "none" } : undefined } > <TableRow sx={ hideKeys ? { display: "none" } : undefined } >
{ rowSelect && <TableCell></TableCell> } { rowSelect && <TableCell></TableCell> }
{ renderGutter && <TableCell></TableCell>} { renderGutter && <TableCell></TableCell>}
{/* { columns ? { columns ?
columns.map((column, index) => { columns.map((column, index) => {
if (filterList.includes(column.title) || column.hidden) return null if (filterList.includes(column.title) || column.hidden) return null
return ( return (
@ -444,7 +440,7 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
</TableCell> </TableCell>
) )
}) })
} */} }
</TableRow> </TableRow>
</TableHead> </TableHead>
<TableBody> <TableBody>
@ -522,7 +518,7 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
) )
}) })
} }
{/* {rows.length < 1 && !isLoading && {rows.length < 1 && !isLoading &&
<TableRow> <TableRow>
<TableCell colSpan={6} sx={{textAlign: "center" }}> <TableCell colSpan={6} sx={{textAlign: "center" }}>
<Typography variant="body2" color="textSecondary"> <Typography variant="body2" color="textSecondary">
@ -530,10 +526,10 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
</Typography> </Typography>
</TableCell> </TableCell>
</TableRow> </TableRow>
} */} }
</TableBody> </TableBody>
</Table> </Table>
{!hidePagination && {/* {!hidePagination && */}
<TablePagination <TablePagination
rowsPerPageOptions={rowsPerPageOptions ? rowsPerPageOptions : [5, 10, 20]} rowsPerPageOptions={rowsPerPageOptions ? rowsPerPageOptions : [5, 10, 20]}
component="div" component="div"
@ -543,7 +539,7 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
onPageChange={(_event, page) => handlePageChange(page)} onPageChange={(_event, page) => handlePageChange(page)}
onRowsPerPageChange={handleRowsPerPageChange} onRowsPerPageChange={handleRowsPerPageChange}
/> />
} {/* } */}
<Menu <Menu
id="userMenu" id="userMenu"
anchorEl={columnAnchor} anchorEl={columnAnchor}