Added more tables to track
This commit is contained in:
1 parent
689f74bf11
commit
af31c564cd
2 files changed
+17
-6
No files matched your search
@@ -15,6 +15,7 @@ import {
|
||||
Stack,
|
||||
} from "@mui/material";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useLocation, useParams } from "react-router-dom";
|
||||
import { setRowsPerPage } from "../../Features/UI/uiSlice";
|
||||
import LeftArrowDouble from "../../assets/icons/left-arrow-double.svg?react";
|
||||
import RightArrowDouble from "../../assets/icons/right-arrow-double.svg?react";
|
||||
@@ -142,11 +143,13 @@ const TablePaginationActions = (props) => {
|
||||
* <BasicTable data={data} rows={rows} paginated={true} />
|
||||
*/
|
||||
|
||||
const BasicTable = ({ data, paginated, reversed, rows = 5 }) => {
|
||||
const BasicTable = ({ data, paginated, reversed }) => {
|
||||
const theme = useTheme();
|
||||
const location = useLocation();
|
||||
const dispatch = useDispatch();
|
||||
const { table } = useSelector((state) => state.ui);
|
||||
let rowsPerPage = table.rowsPerPage;
|
||||
const uiState = useSelector((state) => state.ui);
|
||||
let table = location.pathname.split("/").pop();
|
||||
let rowsPerPage = uiState[table].rowsPerPage;
|
||||
const [page, setPage] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -158,7 +161,12 @@ const BasicTable = ({ data, paginated, reversed, rows = 5 }) => {
|
||||
};
|
||||
|
||||
const handleChangeRowsPerPage = (event) => {
|
||||
dispatch(setRowsPerPage(parseInt(event.target.value, 10)));
|
||||
dispatch(
|
||||
setRowsPerPage({
|
||||
value: parseInt(event.target.value, 10),
|
||||
table: table,
|
||||
})
|
||||
);
|
||||
setPage(0);
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user