|
|
|
@ -9,7 +9,9 @@ import CustomPagination from './CustomPagination';
|
|
|
|
|
|
|
|
|
|
// project imports
|
|
|
|
|
const MuiDataGrid = ({
|
|
|
|
|
// apiRef = () => {},
|
|
|
|
|
isCheckbox = false,
|
|
|
|
|
// isDisableSelection = true,
|
|
|
|
|
columns,
|
|
|
|
|
rowsState = { page: 0, pageSize: 10, rows: [] },
|
|
|
|
|
totalCount = 0,
|
|
|
|
@ -18,7 +20,7 @@ const MuiDataGrid = ({
|
|
|
|
|
handleSelection = () => {}
|
|
|
|
|
}) => {
|
|
|
|
|
const theme = useTheme();
|
|
|
|
|
// const apiRef = useGridApiRef();
|
|
|
|
|
const { page, pageSize, rows } = rowsState;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Box
|
|
|
|
@ -55,7 +57,6 @@ const MuiDataGrid = ({
|
|
|
|
|
rowCount={totalCount}
|
|
|
|
|
checkboxSelection={isCheckbox}
|
|
|
|
|
disableSelectionOnClick
|
|
|
|
|
// isRowSelectable={(params: any) => params.row.id > 0}
|
|
|
|
|
columns={columns}
|
|
|
|
|
{...rowsState}
|
|
|
|
|
onPageChange={(page) => setRowsState((prev) => ({ ...prev, page }))}
|
|
|
|
@ -63,12 +64,16 @@ const MuiDataGrid = ({
|
|
|
|
|
rowsPerPageOptions={[10, 50, 100]}
|
|
|
|
|
onCellClick={handleCellClick}
|
|
|
|
|
onSelectionModelChange={handleSelection}
|
|
|
|
|
// isRowSelectable={(params) => params.row.rowId < 50000}
|
|
|
|
|
pagination
|
|
|
|
|
// hideFooter
|
|
|
|
|
// hideFooterPagination
|
|
|
|
|
components={{
|
|
|
|
|
Footer: CustomPagination
|
|
|
|
|
}}
|
|
|
|
|
componentsProps={{
|
|
|
|
|
footer: { totalCount, pageSize }
|
|
|
|
|
}}
|
|
|
|
|
initialState={{
|
|
|
|
|
pagination: {
|
|
|
|
|
pageSize: rowsState.pageSize,
|
|
|
|
@ -81,10 +86,15 @@ const MuiDataGrid = ({
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
MuiDataGrid.propTypes = {
|
|
|
|
|
// apiRef: PropTypes.func,
|
|
|
|
|
isCheckbox: PropTypes.bool,
|
|
|
|
|
// isHideFooter: PropTypes.bool,
|
|
|
|
|
// isDisableSelection: PropTypes.bool,
|
|
|
|
|
columns: PropTypes.array,
|
|
|
|
|
rowsState: PropTypes.any,
|
|
|
|
|
rowsState: {
|
|
|
|
|
page: PropTypes.number,
|
|
|
|
|
pageSize: PropTypes.number,
|
|
|
|
|
rows: PropTypes.array
|
|
|
|
|
},
|
|
|
|
|
totalCount: PropTypes.number,
|
|
|
|
|
setRowsState: PropTypes.func,
|
|
|
|
|
handleCellClick: PropTypes.func,
|
|
|
|
|