![](/img/trans.png)
[英]Shield ui grid hierarchy grid make non-editable while main grid editable
[英]Can we make some rows non-editable in react-data-grid?
我正在使用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將“editable”作為輸入函數。
在這里,我們可以傳遞自定義邏輯來確定是否允許特定單元格進行編輯。
columns = [
{
key: 'id',
name: 'ID'
},
{
key: 'location_id',
name: 'Location ID',
editable: function(rowData) {
return rowData.allowEdit === true;
}
}
]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.