react-data-grid icon indicating copy to clipboard operation
react-data-grid copied to clipboard

Deactivate editor mode if cell is not editable - old version

Open Gaetanbrl opened this issue 1 year ago • 0 comments

Hi !

Environment

Versions :

    "react-data-grid": "5.0.4",
    "react-data-grid-addons": "5.0.4",

I know these versions are old dated and addons is deprecated, but the real sad world often needs to maintain solutions without create new one on each dep upgrade.

To Reproduce

I use onCheckCellIsEditable param to restrict editor mode by field. This allow a user to change some fields only and limit modification to some other fields.

If i have 3 fields ID, NAME, COMMENT, the use case is :

As administrator, i want to allow user to change COMMENT field and forbide to change NAME and ID fields.

Well, onCheckCellIsEditable works fine and i cant edit NAME field if I double clicked on.

But if i start by edit COMMENT, and single click on NAME, I can edit NAME field.

Here an other example where NOM field can't be editing if I click on it first -> But i can edit him if I start by click on other first to open editor mode.

reactdatagrid

In addition, onCheckCellIsEditable if editor mode is activate. Only onCellSelected event return something.

Link to code example:

  onCheckCellIsEditable={({column}) => {
      console.log("Avoid to activate editor mode");
      console.log("Will be not check if editor mode is already activate");
      return column.editable;
  }}
  onCellSelected={(z) => {
      console.log("OK works on each cell click");
  }}

So, how to deactivate editor mode if cell is not really editable (because field is not editable) ??

Thanks.

Expected behavior

On each field's click, i expect to check if cell is really editable.

Gaetanbrl avatar Jan 02 '24 09:01 Gaetanbrl