import { DataGrid } from '@mui/x-data-grid';

interface Props {
    rows: any,
    columns: any
}

export default function DataTable(props: Props) {

    return (
        <DataGrid
            autoHeight
            style={{ width: "100%" }}
            rows={props.rows}
            columns={props.columns}
            initialState={{
                pagination: {
                    paginationModel: { page: 0, pageSize: 10 },
                },
            }}
            pageSizeOptions={[10, 20, 50, 100]}
            checkboxSelection
            disableRowSelectionOnClick

            processRowUpdate={(updatedRow, originalRow) => {
                console.log(updatedRow)
                return updatedRow
            }}

            onProcessRowUpdateError={(error)=>{
                console.log(error)
            }}
        />
    );
}