我正在使用 react-data-grid用于在页面中显示可编辑表格。我使用 editable: true
启用可编辑列。但我有一些不可编辑的行。我如何在行级控制它?
请提出解决方案。 PFB数据网格的初始化。
<ReactDataGrid
enableCellSelect={true}
columns={this.state.columns}
rowGetter={rowGetter}
rowsCount={this.state.rows.length}
rowHeight={35}
minHeight={500}
onGridRowsUpdated={this.handleGridRowsUpdated}/>
最佳答案
ReactDataGrid 将“可编辑”作为输入函数。
在这里,我们可以传递自定义逻辑以确定是否允许对特定单元格进行编辑。
columns = [
{
key: 'id',
name: 'ID'
},
{
key: 'location_id',
name: 'Location ID',
editable: function(rowData) {
return rowData.allowEdit === true;
}
}
]
关于javascript - 我们可以在 react-data-grid 中使某些行不可编辑吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43316431/