Added prop to display # of rows
This commit is contained in:
1 parent
49f9f1429a
commit
d897f0be83
2 files changed
+4
-3
No files matched your search
@@ -33,6 +33,7 @@ import ArrowForwardRoundedIcon from "@mui/icons-material/ArrowForwardRounded";
|
|||||||
* @param {function} props.data.rows.data.handleClick - Function to call when the row is clicked.
|
* @param {function} props.data.rows.data.handleClick - Function to call when the row is clicked.
|
||||||
* @param {boolean} [props.paginated=false] - Flag to enable pagination.
|
* @param {boolean} [props.paginated=false] - Flag to enable pagination.
|
||||||
* @param {boolean} [props.reversed=false] - Flag to enable reverse order.
|
* @param {boolean} [props.reversed=false] - Flag to enable reverse order.
|
||||||
|
* @param {number} props.rowsPerPage- Number of rows per page (table).
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* const data = {
|
* const data = {
|
||||||
@@ -67,11 +68,10 @@ import ArrowForwardRoundedIcon from "@mui/icons-material/ArrowForwardRounded";
|
|||||||
* <BasicTable data={data} rows={rows} paginated={true} />
|
* <BasicTable data={data} rows={rows} paginated={true} />
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const BasicTable = ({ data, paginated, reversed }) => {
|
const BasicTable = ({ data, paginated, reversed, rowsPerPage = 5 }) => {
|
||||||
// Add headers to props validation
|
// Add headers to props validation
|
||||||
|
|
||||||
const [page, setPage] = useState(0);
|
const [page, setPage] = useState(0);
|
||||||
const rowsPerPage = 5;
|
|
||||||
|
|
||||||
const handleChangePage = (event, newPage) => {
|
const handleChangePage = (event, newPage) => {
|
||||||
setPage(newPage);
|
setPage(newPage);
|
||||||
@@ -158,6 +158,7 @@ BasicTable.propTypes = {
|
|||||||
data: PropTypes.object.isRequired,
|
data: PropTypes.object.isRequired,
|
||||||
paginated: PropTypes.bool,
|
paginated: PropTypes.bool,
|
||||||
reversed: PropTypes.bool,
|
reversed: PropTypes.bool,
|
||||||
|
rowPerPage: PropTypes.number,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default BasicTable;
|
export default BasicTable;
|
||||||
@@ -158,7 +158,7 @@ const Incidents = () => {
|
|||||||
/>
|
/>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
</Stack>
|
</Stack>
|
||||||
<BasicTable data={data} paginated={true} />
|
<BasicTable data={data} paginated={true} rowsPerPage={12}/>
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user