<DataGrid
className={classes.datagrid}
page={page}
pageSize={rowsPerPage}
rows={rows}
columns={columns}
sortModel={sortModel}
rowCount={meta.total}
loading={store.panels.loading}
rowsPerPageOptions={
[5, 10, 25, 50] as PageSizeOptions[]
}
disableSelectionOnClick
onPageSizeChange={changePageSize}
autoHeight
onPageChange={handlePageChange}
onSortModelChange={updateSort}
components={{
loadingOverlay: LoadingOverlay,
noRowsOverlay: NoRowOverlay,
}}
/>
TypeError: Cannot read property 'id' of undefined
(anonymous function)
node_modules/@material-ui/data-grid/dist/index-esm.js:15
etc...
The mobx array is an array of objects [ { id: 1, name: "bob" }, etc... ]
The columns:
const columns: ColDef[] = [
{ field: 'id', hide: true },
{
headerName: 'Name',
field: 'name',
width: 110,
},
];
This error only occurs when I try to remove a row. Adding, fetching or updating works fine.
It seems to be a bug with MUI DataGrid https://material-ui.com/components/data-grid/rows/
Let me know.
Regards, Emir
The fix was released in v4.0.0-alpha.10. Reference: https://github.com/mui-org/material-ui-x/issues/571