Material table editable with condition

Viewed 28

I was trying to create a material table:

  1. I have three column, which are Type, Mark, and Total.
  2. I implement the inline edit, user can edit the total only. enter image description here
  3. When user click add new button, they can type in type, mark and total. enter image description here

I'm fine with the edit part.

For the add part, all column is editable now, but I want to do it like column is editable based on condition.

For example: If user fill in the type = "Deliver", the mark column should be disabled, user cannot edit that column. How can I do this?

Here is sandbox url: https://codesandbox.io/s/test-qgtm0g?file=/demo.tsx

0 Answers
Related