物料表onRowClick和操作按钮单击重叠

时间:2019-11-20 17:56:50

标签: material-table

<MaterialTable 
onRowClick={() => openRightDrawer()}
actions={[
{
icon:"Check",
tooltip:"Activate",
onClick: () => activateAccount()
}
]}
components={{
Action: props => <Button onClick={() => props.action.onClick()}>Activate</Button>
}}
/>

当我单击按钮时,onRowClick事件也会触发此问题的解决方法吗?

1 个答案:

答案 0 :(得分:0)

感谢@mbrn,让它正常工作https://github.com/mbrn/material-table/issues/1362

<MaterialTable 
onRowClick={() => openRightDrawer()}
actions={[
{
icon:"Check",
tooltip:"Activate",
onClick: () => activateAccount()
}
]}
components={{
Action: props => <Button onClick={(event) => {
    props.action.onClick();
    event.stopPropagation();
 }
}>Activate</Button>
}}
/>