从详细信息面板 material-table 发送行数据时出错
Error sending the data of the row from the detail panel material-table
我正在尝试将操作传递给 material-table 详细信息面板,但由于某些原因,按钮没有将行数据发送到对话框。传递了其他道具,但没有传递行数据。
看道具就知道了
{show: true, rowUser: undefined, ƒ}
我是否以正确的方式在行中传递数据?
可能是什么问题?
detailPanel={[{
icon: 'account_circle',
tooltip: 'Show Surname',
render: rowData=> {
return (
<IconButton aria-label="User" onClick={(event, rowData)=>{
setRows(rowData);
setOpen(true);} }>
<MenuBookIcon />
</IconButton>
)
},
},
]}
您希望在第一个函数中使用 rowData。 iconButton 的 onClick 有一个参数:event;不是两个。你需要把你的功能改成这个
<IconButton aria-label="User" onClick={(event)=>{
setRows(rowData);
setOpen(true);} }>
我正在尝试将操作传递给 material-table 详细信息面板,但由于某些原因,按钮没有将行数据发送到对话框。传递了其他道具,但没有传递行数据。
看道具就知道了
{show: true, rowUser: undefined, ƒ}
我是否以正确的方式在行中传递数据? 可能是什么问题?
detailPanel={[{
icon: 'account_circle',
tooltip: 'Show Surname',
render: rowData=> {
return (
<IconButton aria-label="User" onClick={(event, rowData)=>{
setRows(rowData);
setOpen(true);} }>
<MenuBookIcon />
</IconButton>
)
},
},
]}
您希望在第一个函数中使用 rowData。 iconButton 的 onClick 有一个参数:event;不是两个。你需要把你的功能改成这个
<IconButton aria-label="User" onClick={(event)=>{
setRows(rowData);
setOpen(true);} }>