now testing if it is because the array is empty

This commit is contained in:
csawatzky 2025-04-10 12:07:36 -06:00
parent b835524700
commit 407a8fc8c1
4 changed files with 12 additions and 10 deletions

View file

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

View file

@ -133,11 +133,11 @@ export default function CableTable(props: Props) {
columns={columns}
rows={cableData}
page={0}
pageSize={5}
pageSize={0}
total={0}
setPage={()=>{}}
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
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
//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>) {
@ -120,7 +120,7 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
selectedRows,
customElement,
mobileView,
//hidePagination
hidePagination
} = props
const classes = useStyles();
const columns = typeof(props.columns) === "function" ? props.columns() : props.columns
@ -529,7 +529,7 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
}
</TableBody>
</Table>
{/* {!hidePagination && */}
{!hidePagination &&
<TablePagination
rowsPerPageOptions={rowsPerPageOptions ? rowsPerPageOptions : [5, 10, 20]}
component="div"
@ -539,7 +539,7 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
onPageChange={(_event, page) => handlePageChange(page)}
onRowsPerPageChange={handleRowsPerPageChange}
/>
{/* } */}
}
<Menu
id="userMenu"
anchorEl={columnAnchor}

View file

@ -17,14 +17,16 @@ interface Props {
export default function TransactionViewer(props: Props) {
const { transactions, loading, objectNames } = props;
const [displayedRows, setDisplayedRows] = useState<Transaction[]>([])
const [displayedRows, setDisplayedRows] = useState<Transaction[]>([Transaction.create()])
const [tablePage, setTablePage] = useState(0)
const [pageSize, setPageSize] = useState(10)
useEffect(()=>{
let clone: Transaction[] = cloneDeep(transactions)
let rows = clone.splice(tablePage * pageSize, pageSize)
if (rows.length !== 0){
setDisplayedRows(rows)
}
},[transactions, tablePage, pageSize])
const columns: Column<Transaction>[] = [