material-table icon indicating copy to clipboard operation
material-table copied to clipboard

How do I disable edit/delete on a row?

Open jt988 opened this issue 6 years ago • 6 comments

I have a totals row that I don't want the user to be able to update/delete, I have tried: editable = {{ isEditable: rowData => rowData.name === "Totals", isDeletable: rowData => rowData.name === "Totals", ... per the example, but this doesn't seem to work...is this a bug or have I done something wrong?

jt988 avatar Feb 05 '20 01:02 jt988

@jjt1234 is your column that has the title "Totals" called name? If not, then you should change rowData.name to rowData.columnName.

On another note, I am experiencing the same issue where I cannot prevent editing of rows that meet the given condition. My material-table package is up to date with 1.57.2

william13murphy avatar Feb 13 '20 20:02 william13murphy

Done the same to disable the rows - it doesn't work for me. If you have demo somewhere - that would help. Thanks

sakhibgareevrr avatar Feb 24 '20 14:02 sakhibgareevrr

@sakhibgareevrr I have verified that isEditable is working properly in release 1.57.2

I recommend to delete package-lock.json and /node_modules, followed by installing your dependencies (npm i). If you would like, you can also share a code snippet here or in another issue.

william13murphy avatar Feb 24 '20 15:02 william13murphy

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.

stale[bot] avatar Jul 05 '20 20:07 stale[bot]

try this

isDeletable: rowData => { rowData // isSupport = false if(isSupport) { return false } else { return true } }

or just copy paste this and test it from both false and true isDeletable: rowData => true // disabled isDeletable: rowData => false // enabled

ildefonsorobinjohn avatar Jul 07 '20 10:07 ildefonsorobinjohn

Thanks @ildefonsorobinjohn, option 1 worked for me..

Raji-P avatar Mar 17 '22 19:03 Raji-P