Code Monkey home page Code Monkey logo

Comments (6)

mdrake411 avatar mdrake411 commented on August 24, 2024 1

@michelengelen Thanks for taking a look. I agree about the documentation, and the how the name should probably be isRowEditable. Furthermore, there is no apparent way to pass in a field name to indicate which cell to disable.

Is there any kind of work-around to make an individual cell non-editable under certain conditions? In the column definition, there is an editable property, but I do not see a way to set it programmatically.

from mui-x.

michelengelen avatar michelengelen commented on August 24, 2024

Hey @mdrake411 I can confirm this is a bug. Thanks for raising this!

@cherniavskii I'll add this to the board, so we can have a look.
As it seems the description in the docs is also a bit misleading.

It clearly states that isCellEditable can be used to define which individual cells are editable,

You can use the isCellEditable callback prop to define which individual cells the user can edit in a given row.

but in the last section it says that the entire row will be disabled when the callback returns false.

In the following demo, only the rows with an even Age value are editable. The editable cells have a green background for better visibility.

When this is intentional we should rename the prop to isRowEditable and adjust the description as well.

WDYT?

from mui-x.

mdrake411 avatar mdrake411 commented on August 24, 2024

Additional thoughts... if one result of this bug will be to change the name from isCellEditable to isRowEditable, then there should be a corresponding way to disable the edit button in an action column with GridActionsCellItem elements. Otherwise, It could be potentially confusing for a user to click an edit button, have the row turn into edit mode, and not be able to edit any columns.

from mui-x.

Sebcio03 avatar Sebcio03 commented on August 24, 2024

Just encountered this error in my code 😄 Can I fix this?

from mui-x.

czerwinskilukasz1 avatar czerwinskilukasz1 commented on August 24, 2024

@michelengelen , @cherniavskii , some of mdrake411's comments suggest that isCellEditable should be replaced with controlling editable at the row level only.
However, I can see a lot of use cases when we might want to block just a single cell from being edited, in particular in cases like:

  • the current user does not have permissions to edit this field
  • the row represents a deleted/archived entity hence some of the properties should not be altered anymore
  • some types of rows should allow editing only a subset of cells

from mui-x.

mdrake411 avatar mdrake411 commented on August 24, 2024

@czerwinskilukasz1 I did not mean to suggest that "isCellEditable should be replaced with controlling editable at the row level only". I was only making the observation that currently it appears that is what it does, despite its property name.

I agree with your use cases, and I have one similar use case. I need the a row to remain editable while a particular cell in that row is not editable depending on the value of another cell in that same row. I believe that would be more representative of the property name.

from mui-x.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.