Persist Row Click Events

Usage#

info

You can persist onRowClick, or onRowDoubleClick events, if you need access to things like event.target

caution

You must be on version >=4.1.0 to use the persistEvents prop!

import MaterialTable, { MTableBodyRow } from '@material-table/core';
<MaterialTable
// ...
options={{
selection: true,
}}
components={{
Row: (props) => {
return (
<MTableBodyRow
{...props}
persistEvents
onRowClick={handleClick}
/* onRowDoubleClick={...} */
/>;
);
},
}}
/>;

Live Demo#

note

See here for more on the GLOBAL_VARS we use in our demos

Live Editor
Result