react-data-grid
react-data-grid copied to clipboard
When clicking on the table header, onSelectedCellChange is called with row as undefined
Describe the bug
When clicking on the table header that is not sortable, onSelectedCellChange is called with row set as undefined
To Reproduce
- Click on a table header cell that is not sortable
- log the arguments coming in
onSelectedCellChange
Link to code example:
const columns: Column<Accountant>[] = [
{
key: "name",
name: "Name",
resizable: true,
renderCell: (args) => {
return args.row.name;
},
},
{
key: "email",
name: "Email",
resizable: true,
renderCell: (args) => {
return args.row.email;
},
},
];
return <ReactDataGrid
className={`rdg-light`}
rows={props.accountants}
columns={columns}
rowKeyGetter={(r) => r.id}
onSelectedCellChange={(args) => {
props.onAccountantSelect(args.row.id);
}}
/>
Expected behavior
Either:
- don't call
onSelectedCellChangewhen a table header is selected - type
rowargument inonSelectedCellChangeas possiblyundefined
Environment
react-data-gridversion: 7.0.0-beta.46react/react-domversion: 18
Additional context
Can you create a reproducible example?
Closing due to lack of response.