当我使用onClick时,onMeetingTitleClick可以工作,但它只适用于特定的列。
我正试图使用onRowClicked让它为整行工作,但我没有我认为我做得不对。有什么想法吗?
const MeetingsTable = ({ meetings, onMeetingTitleClick }) => {
...
const columns = [
{
name: 'Title',
cell: row => (
<div data-tag="allowRowEvents">
<div aria-hidden="true" onClick={e => onMeetingTitleClick(e, row.id)}>
{row.name}
</div>
</div>
),
},
];
const onRowClicked = () => (result.map(result => (e => onMeetingTitleClick(e, result.id))));
return (
<DataTable
columns={columns}
data={result}
onRowClicked={onRowClicked}
/>
);
... Omitted other values
参考库:https://github.com/jbetancur/react-data-table-component
使用以下成功完成
const onRowClicked = (row, event) => { onMeetingTitleClick(event, row.id); };
https://github.com/jbetancur/react-data-table-component#readme