New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warning on disabled edit buttons #1049
Comments
I'm having a similar warning. Probably corresponds to the same issue. backend.js:1 Warning: Material-UI: you are providing a disabled Place a |
If you need a quick workaround this problem, you can create an
See the Conditionals Actions Example for more info |
@avkonst can you supply the code you are using? An example? Anything...? Are you using custom actions or the built in |
Hi @oze4 Thank you for considering the ticket. Here is the information I can provide:
I use both. For editable, the code looks like this: editable={{
isEditable: (rowData) => false, // real code uses some logic to make certain rows non editable
isDeletable: (rowData) => false,
....
}} For custom actions I use either: const actions = []
actions.push((rowData) => ({
hidden: true,
icon: '',
onClick: () => { return; }
}))
....
actions={actions} or this: const actions = []
actions.push((rowData) => ({
disabled: true,
iconProps: {
fontSize: 'small'
},
icon: () => <>1234</>,
onClick: () => {
....
}
}))
....
actions={actions} I also override MTableBodyRow component like the following (the purpose is to remove (not disable) per row edit and delete actions for some rows): const MTableBodyRowOverride = (rowProps: any) => {
return <MTableBodyRow
{...rowProps}
// the following basically removes all actions added by the material-table
// all my custom actions are marked with the hidden HiddenGroupFold field
actions={rowProps.actions.filter((i: Function) => !i[HiddenGroupFold])}
/>
}</>
}
...
components={{
Row: MTableBodyRowOverriden
}} |
@avkonst you use all of the above examples in a single instance of Material Table? I am interested in the exact case that brought you here.
I am specifically interested in the logic that makes certain rows "non editable". All in all I think it would be easiest if you supplied a reproducible example that mirrors your issue as close as possible. |
For example, the following code does not produce any errors: export default function AppTable() {
return (
<MaterialTable
actions={[
rowdata => ({
icon: () => <DeleteOutlined />,
disabled: true,
tooltip: "Delete"
})
]}
icons={tableIcons}
data={[
{
name: "Rock",
id: 1
},
{
name: "Paper",
id: 2
},
{
name: "Scissors",
id: 3
}
]}
columns={[
{
title: "Item",
field: "name"
},
{
title: "Item ID",
field: "id"
}
]}
/>
);
} |
I will try to find a reproducer. I will try to put some time tomorrow for this. I am sure it is |
Here is the reproducer: <MaterialTable
columns={[
{
field: 'id',
title: 'ID'
}
]}
data={[{ id: 'a' }]}
editable={{
isEditable: rowData => false,
onRowUpdate: (newData, oldData) => Promise.resolve()
}}
/> |
This does not cause an error... Can you either supply code that actually reproduces the error you are getting, or close this issue out?? It would seem the issue is with your logic, not with Material Table. Help me help you. export default function AppTable() {
return (
<MaterialTable
icons={tableIcons}
data={[
{
name: "Rock",
id: 1
},
{
name: "Paper",
id: 2
},
{
name: "Scissors",
id: 3
}
]}
columns={[
{
title: "Item",
field: "name"
},
{
title: "Item ID",
field: "id"
}
]}
editable={{
isEditable: rowData => false,
onRowUpdate: (newData, oldData) => Promise.resolve()
}}
/> |
Upgrade dependencies to latest and you will reproduce it: |
It looks like this started happening in I'm 95% positive that removing the |
@avkonst I have submitted a pull request that resolves this issue.. Hopefully it will be merged soon. |
Thanks
…On Sun, Sep 8, 2019 at 6:02 AM Matt Oestreich ***@***.***> wrote:
@avkonst <https://github.com/avkonst> I have submitted a pull request
that resolves this issue.. Hopefully it will be merged soon.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1049?email_source=notifications&email_token=AA6JSVJA5WGBUBN53J523WLQIPUB5A5CNFSM4ISCJ4DKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6E6O4Q#issuecomment-529131378>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA6JSVP72H3445D4VLAJAU3QIPUB5ANCNFSM4ISCJ4DA>
.
|
@avkonst that's my workaround, at least I don't receive that error in the console.
|
@rkram3r I've been waiting a loong while to get that simple PR merged lol... 😢 Sorry =/ |
Describe the bug
If a specific row has got Edit/Delete actions disabled, there is a warning in console:
Expected behavior
No warning in the console
The reproducer:
The text was updated successfully, but these errors were encountered: