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

Make Edit Button disabled or removed based on condition for rows

Open Simonlfr opened this issue 7 years ago • 21 comments

Right now there seems to be no way to disable the edit button on each row based on conditions.

For example like in this picture where the button is grayed out based on a condition. image

Simonlfr avatar Apr 24 '19 13:04 Simonlfr

Hi @LTank ,

I added isEditable and isDeletable fields. I will publish it tomorrow. You can look at usage on documentation.

mbrn avatar May 02 '19 13:05 mbrn

1.35.0 published

mbrn avatar May 03 '19 05:05 mbrn

https://material-table.com/#/docs/features/editable

mbrn avatar May 03 '19 05:05 mbrn

Hey @mbrn

Really enjoying using mat-table. I was wondering if there is a way to conditionally disable the check button based on values entered during adding/updating a row?

For e.g. User clicks on edit, they enter value A in Column1, check button stays clickable, if they enter value B or leave column1 blank, the check button is unclickable.

Thanks!

ajayraveendran avatar Nov 09 '19 00:11 ajayraveendran

Hi @mbrn I tried using isEditable: rowData => rowData.name === "Sarah" but edit icon is not disabling what can be causing this? And is there any way to disable actions buttons on (react) state condition Thx.

n-so avatar Nov 17 '19 12:11 n-so

isEditable has an option to show either delete only or edit only based on the user permissions?

chipmunk25 avatar Nov 25 '19 16:11 chipmunk25

Hi @mbrn I tried using isEditable: rowData => rowData.name === "Sarah" but edit icon is not disabling what can be causing this? And is there any way to disable actions buttons on (react) state condition Thx.

it u can case your rowData.name and "Sarah" to make sure the compare works well

chipmunk25 avatar Nov 25 '19 17:11 chipmunk25

Is there a way to actually remove the edit button? I only want the inline delete feature on my MaterialTable, and would like to use a custom action for editing.

Jvictor97 avatar Dec 16 '19 13:12 Jvictor97

Is there a way to actually remove the edit button? I only want the inline delete feature on my MaterialTable, and would like to use a custom action for editing.

u can do two things , either u use an action then u do your own remove or edit button or use edittable who u use only one

chipmunk25 avatar Dec 16 '19 13:12 chipmunk25

u can also customize an edittable button

chipmunk25 avatar Dec 16 '19 13:12 chipmunk25

@mbrn @chipmunk25 isEditable and isDeletable are not working!! , can you help?

muhadel avatar Dec 19 '19 09:12 muhadel

Having the same issue. Even isDeletable: (rowData) => false doesn't disable the delete button

twgardner2 avatar Dec 19 '19 18:12 twgardner2

Having the same issue. Even isDeletable: (rowData) => false doesn't disable the delete button

it looks like material-table is having a problem mine has stop working

chipmunk25 avatar Dec 20 '19 09:12 chipmunk25

Having the same issue. Even isDeletable: (rowData) => false doesn't disable the delete button

same here

gabriellupu avatar Jan 08 '20 11:01 gabriellupu

This is broken after 1.54.0. Is there going to be a fix for this?

zhex900 avatar Jan 15 '20 02:01 zhex900

isEditable and isDeletable not working even with: isEditable: rowData => false, isDeletable : rowData => false

Androsv96 avatar Jan 16 '20 15:01 Androsv96

isEditable and isDeletable are not working. Reverting back to 1.54.0 worked as @zhex900 said.

konstantinpachemski avatar Jan 23 '20 15:01 konstantinpachemski

See #1400

Androsv96 avatar Feb 04 '20 19:02 Androsv96

Is there a way to disable add button?

ksavic avatar Apr 28 '20 18:04 ksavic

@ksavic You can remove onRowAdd from the editable props object.

muhadel avatar Apr 29 '20 09:04 muhadel