now testing if it is because the array is empty
This commit is contained in:
parent
b835524700
commit
407a8fc8c1
4 changed files with 12 additions and 10 deletions
|
|
@ -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={5}
|
pageSize={0}
|
||||||
handleRowsPerPageChange={()=>{}}
|
handleRowsPerPageChange={()=>{}}
|
||||||
setPage={()=>{}}
|
setPage={()=>{}}
|
||||||
total={0}
|
total={0}
|
||||||
//hidePagination
|
hidePagination
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -133,11 +133,11 @@ export default function CableTable(props: Props) {
|
||||||
columns={columns}
|
columns={columns}
|
||||||
rows={cableData}
|
rows={cableData}
|
||||||
page={0}
|
page={0}
|
||||||
pageSize={5}
|
pageSize={0}
|
||||||
total={0}
|
total={0}
|
||||||
setPage={()=>{}}
|
setPage={()=>{}}
|
||||||
handleRowsPerPageChange={()=>{}}
|
handleRowsPerPageChange={()=>{}}
|
||||||
//hidePagination
|
hidePagination
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
@ -529,7 +529,7 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
|
||||||
}
|
}
|
||||||
</TableBody>
|
</TableBody>
|
||||||
</Table>
|
</Table>
|
||||||
{/* {!hidePagination && */}
|
{!hidePagination &&
|
||||||
<TablePagination
|
<TablePagination
|
||||||
rowsPerPageOptions={rowsPerPageOptions ? rowsPerPageOptions : [5, 10, 20]}
|
rowsPerPageOptions={rowsPerPageOptions ? rowsPerPageOptions : [5, 10, 20]}
|
||||||
component="div"
|
component="div"
|
||||||
|
|
@ -539,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}
|
||||||
|
|
|
||||||
|
|
@ -17,14 +17,16 @@ interface Props {
|
||||||
|
|
||||||
export default function TransactionViewer(props: Props) {
|
export default function TransactionViewer(props: Props) {
|
||||||
const { transactions, loading, objectNames } = props;
|
const { transactions, loading, objectNames } = props;
|
||||||
const [displayedRows, setDisplayedRows] = useState<Transaction[]>([])
|
const [displayedRows, setDisplayedRows] = useState<Transaction[]>([Transaction.create()])
|
||||||
const [tablePage, setTablePage] = useState(0)
|
const [tablePage, setTablePage] = useState(0)
|
||||||
const [pageSize, setPageSize] = useState(10)
|
const [pageSize, setPageSize] = useState(10)
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
let clone: Transaction[] = cloneDeep(transactions)
|
let clone: Transaction[] = cloneDeep(transactions)
|
||||||
let rows = clone.splice(tablePage * pageSize, pageSize)
|
let rows = clone.splice(tablePage * pageSize, pageSize)
|
||||||
setDisplayedRows(rows)
|
if (rows.length !== 0){
|
||||||
|
setDisplayedRows(rows)
|
||||||
|
}
|
||||||
},[transactions, tablePage, pageSize])
|
},[transactions, tablePage, pageSize])
|
||||||
|
|
||||||
const columns: Column<Transaction>[] = [
|
const columns: Column<Transaction>[] = [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue