// material-ui import * as React from 'react'; import { DataGrid, GridActionsCellItem, } from "@mui/x-data-grid"; import EditIcon from '@mui/icons-material/Edit'; import {useEffect} from "react"; import {useNavigate} from "react-router-dom"; import { useTheme } from '@mui/material/styles'; import Checkbox from '@mui/material/Checkbox'; import {CustomNoRowsOverlay} from "../../utils/CommonFunction"; import {LIONER_BUTTON_THEME} from "../../themes/colorConst"; import {ThemeProvider} from "@emotion/react"; // ==============================|| EVENT TABLE ||============================== // export default function UserTable({recordList}) { const [rows, setRows] = React.useState(recordList); const [rowModesModel] = React.useState({}); const theme = useTheme(); const navigate = useNavigate() const [paginationModel, setPaginationModel] = React.useState({ page: 0, pageSize:10 }); useEffect(() => { setPaginationModel({page:0,pageSize:10}); setRows(recordList); }, [recordList]); const handleEditClick = (id) => () => { navigate('/user/'+ id); }; const columns = [ { field: 'actions', type: 'actions', headerName: 'Actions', width: 100, cellClassName: 'actions', getActions: ({id}) => { return [ } label="Edit" className="textPrimary" onClick={handleEditClick(id)} color="edit" /> ] }, }, { id: 'username', field: 'username', headerName: 'User Name', flex: 0.8, }, { id: 'name', field: 'fullname', headerName: 'Full Name', flex: 0.75, }, { id: 'post', field: 'post', headerName: 'Post', flex: 0.5, }, { id: 'email', field: 'email', headerName: 'Email', flex: 1.45, renderCell: (params) => { return (
{params.value}
); } }, { id: 'subDivision', field: 'subDivision', //type: 'date', //sortable: false, headerName: 'Sub-Division', flex: 1.45, renderCell: (params) => { return (
{params.value}
); } }, { id: 'lotusNotesUser', field: 'lotusNotesUser', type: 'bool', headerName: 'Lotus Notes', flex: 0.63, renderCell: (params) => { return ( ); }, }, { id: 'locked', field: 'locked', type: 'bool', headerName: 'Locked', flex: 0.5, renderCell: (params) => { return ( ); }, }, ]; return (
'auto'} slots={{ noRowsOverlay: () => ( CustomNoRowsOverlay() ) }} pageSizeOptions={[10]} autoHeight />
); }