Closed
Description
openedon Apr 28, 2021
What you were expecting:
Disabled checkboxes where isRowSelectable criteria is false and the remaining rows remain selectable
What happened instead:
Error when clicking a checkbox due to missing event parameter
Steps to reproduce:
Follow example from here: https://marmelab.com/react-admin/List.html#body-element
I fixed it by making the following changes:
Adding selectable prop instead of record.selectable which doesn't exist
and added event parameter as onToggleItem expects this
const MyDatagridRow = ({ record, resource, id, onToggleItem, children, selected, selectable, basePath }) => (
<TableRow key={id}>
{/* first column: selection checkbox */}
<TableCell padding="none">
<Checkbox
disabled={selectable}
checked={selected}
onClick={(event) => onToggleItem(id, event)}
/>
</TableCell>
{/* data columns based on children */}
{React.Children.map(children, field => (
<TableCell key={`${id}-${field.props.source}`}>
{React.cloneElement(field, {
record,
basePath,
resource,
})}
</TableCell>
))}
</TableRow>
);```
Metadata
Assignees
Labels
No labels
Activity