React-data-grid: Disabling a specific cell on the grid

Created on 27 Oct 2016  路  10Comments  路  Source: adazzle/react-data-grid

[ ] bug report
[X] feature request
[ ] support request

Is it possible to disable a specific cell on the grid?

Question

Most helpful comment

You can use onCheckCellIsEditable prop to make some cells readonly.

checkCellEditable = ({ column, row }) => {
   // Return true/false
};

render() {
  return(
     <ReactDataGrid ... 
        onCheckCellEditable={this.checkCellEditable}
     />
  );
}

All 10 comments

Hi @nicomfe, what do you mean by disabling?

Hide a cell? Make it readonly?

make it readonly

Any workaround?

@nicomfe @pidupuis any updates?

@dg92 Nope :/

You can use onCheckCellIsEditable prop to make some cells readonly.

checkCellEditable = ({ column, row }) => {
   // Return true/false
};

render() {
  return(
     <ReactDataGrid ... 
        onCheckCellEditable={this.checkCellEditable}
     />
  );
}

You can use onCheckCellIsEditable prop to make some cells readonly.

checkCellEditable = ({ column, row }) => {
   // Return true/false
};

render() {
  return(
     <ReactDataGrid ... 
        onCheckCellEditable={this.checkCellEditable}
     />
  );
}

when defining checkCellEditable like so to make all cells editable:

checkCellEditable = ({ column, row }) => true

All cells are still read only.

You can use onCheckCellIsEditable prop to make some cells readonly.

checkCellEditable = ({ column, row }) => {
   // Return true/false
};

render() {
  return(
     <ReactDataGrid ... 
        onCheckCellEditable={this.checkCellEditable}
     />
  );
}

when defining checkCellEditable like so to make all cells editable:

checkCellEditable = ({ column, row }) => true

All cells are still read only.

@zebralight This disables the entire row, what about just particular cells (eg. A cell at column 1, row 2)

You can use onCheckCellIsEditable prop to make some cells readonly.

checkCellEditable = ({ column, row }) => {
   // Return true/false
};

render() {
  return(
     <ReactDataGrid ... 
        onCheckCellEditable={this.checkCellEditable}
     />
  );
}

when defining checkCellEditable like so to make all cells editable:

checkCellEditable = ({ column, row }) => true

All cells are still read only.

@zebralight This disables the entire row, what about just particular cells (eg. A cell at column 1, row 2)

Nevermind found out that you can utilize the editable prop in columns that takes the rowData prop and disable that certain column and row (cell) when the data changes.

columns = [
      {
        key: 'id',
        name: 'ID'
      },
      {
        key: 'location_id',
        name: 'Location ID',
        editable: function(rowData) {
          return rowData.allowEdit === true;
        }
      }
]

You can use onCheckCellIsEditable prop to make some cells readonly.

checkCellEditable = ({ column, row }) => {
   // Return true/false
};

render() {
  return(
     <ReactDataGrid ... 
        onCheckCellEditable={this.checkCellEditable}
     />
  );
}

Hi - Thanks for the solution. There is a typo in this example. In the ReactDataGrid JSX component, the onCheckCellEditable prop should be onCheckCellIsEditable.
Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KalKhera picture KalKhera  路  3Comments

soma83 picture soma83  路  4Comments

alvaro1728 picture alvaro1728  路  4Comments

jmahony picture jmahony  路  4Comments

JimLynchCodes picture JimLynchCodes  路  4Comments