Here's my code for reference.
I have a custom dropdown menu for one of my actions which disappears when I turn on the selection option. It seems like I have to choose one or the other. Can anyone help?
<MaterialTable
title={<img src={cover} alt="Cover Logo" />}
columns={columns}
data={tasks}
options={{
pageSizeOptions: [10, 50, 100, 500],
pageSize: 10,
actionsColumnIndex: 10,
selection: true,
showSelectAllCheckbox: false
}}
editable={{
onRowUpdate: (newData, oldData) =>
new Promise(resolve => {
setTimeout(() => {
console.log("onRowUpdate", newData, oldData);
props.updateTasks(newData, oldData);
resolve();
}, 600);
})
}}
onSelectionChange={row => {
if (row.length > 0) {
props.updateSelected(row[0].sid);
}
}}
actions={[
rowData => ({
icon: () => <ActionMenu/>
})
]}
components={{
Toolbar: props => (
<div>
<MTableToolbar {...props} />
<div style={{ padding: "0px 10px" }}>
<PitchForm color="primary" pitchType="pitch" />
</div>
</div>
)
}}
/>
actions={[
rowData => ({
icon: () => <ActionMenu/>
position: 'row',
})
]}
Add position: 'row', it should help
I faced really similar problem few hours ago. It may be helpful. In my case, passing the position field did not help, because I passed the actions as functions.
It took me few really long hours, but the problem was solved only when instead of array of function returning an object, I passed the objects directly. What i mean is:
actions={[
{
icon: () => <ActionMenu/>
position: 'row',
}
]}
Thanks guys. Much appreciated
Most helpful comment
Add
position: 'row', it should help