我们可以在 react-data-grid 中使某些行不可编辑吗?

Can we make some rows non-editable in react-data-grid?

我正在使用 react-data-grid 在页面中显示 editable table。我使用 editable: true 来启用 editable 列。但是我有一些行是非 editable。我如何在行级控制它?

请提出解决方案。 PFB数据网格的初始化。

<ReactDataGrid
    enableCellSelect={true}
    columns={this.state.columns}
    rowGetter={rowGetter}
    rowsCount={this.state.rows.length}
    rowHeight={35}
    minHeight={500}
    onGridRowsUpdated={this.handleGridRowsUpdated}/>

ReactDataGrid 将 "editable" 作为输入函数。

在这里,我们可以传递自定义逻辑以确定是否允许对特定单元格进行编辑。

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