Actions passed as functions, when (selection: true), are ignore
This problem has been documented before in #1662, #2039.
Basically when you have actions passed like this, with the selection: true option:
actions={[
(rowData) => {
console.log('rowdata', rowData);
return {
icon: tableIcons.Add,
tooltip: 'Adicionar Substância ou Polímero',
onClick: () => setDialog(true),
position: 'row'
}
},
{
icon: tableIcons.Add,
tooltip: 'Adicionar Substância ou Polímero',
onClick: () => setDialog(true),
position: 'row'
}
]}
The action that is passed has a function is ignored, it does NOT appear in the table column actions.
This invalidates conditional action rendering when selection: true.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.
@LuisPinaSoares actually it's not ignored, it just overrides the position and displays the action in the toolbar as found here #2696.
It seems like a bug to me, there is no reason why wouldn't take the position into account.
Thanks to the explanation in the issue #2696, I think this could do the trick. Instead of passing a function, give an object containing the action and a position property.
actions={[
{
action : (rowData) => {
console.log('rowdata', rowData);
return {
icon: tableIcons.Add,
tooltip: 'Adicionar Substância ou Polímero',
onClick: () => setDialog(true),
}
},
position : 'row'
},
{
icon: tableIcons.Add,
tooltip: 'Adicionar Substância ou Polímero',
onClick: () => setDialog(true),
position: 'row'
}
]}