Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Yes, the names of rows can be modified in MUI DataGrid. This can be achieved by setting the getRowId prop and returning an object with a data property containing the row data and a id property containing the unique identifier for the row. Then, you can use the renderCell prop to render the cell with your desired name. Here's an example:

<DataGrid
  rows={rows}
  columns={columns}
  getRowId={(row) => ({ id: row.id, data: row })}
  renderCell={(params) => (
    <TableCell>
      {params.row.data.name} {/* replace name with your desired row name */}
    </TableCell>
  )}
/>

In this example, we're using the name property of the row data as the row name. You can replace this with any property or value you like.