I am working on a react app and I am using the MUI Datagrid to display some data. I have used a rendercell to add an edit icon which I would like to open a pop up modal. Below is the column.
export const someColumn = [
{
field: "price",
headerName: "Price",
flex: 1,
cellClassName: "name-column--cell",
},
{
field: "editPrice",
headerName: "Edit Price",
flex: 1,
editable: false,
renderCell: (params) => {
return (
<FiEdit onClick={() => alert(params.row.price)} /> //I want to open modal with the ID as a parameter} className='cursor-pointer' />
);
},
},
];
In the component that has the Datagrid, I have the openModal function that should open the modal.
const openModal = () => {
setShowModal(true);
}
This is my Datagrid
<DataGrid
autoHeight
rows={someArray}
columns={someColumn}
slots={{ toolbar: CustomToolbar }}
/>;
How can I get the button to open up the modal? Please help.
Thanks.