如果我在定义网格时将editable属性设置为true,则启用它,但是如果我在复选框的click事件上将其设置为true,则其值将被更改,但我无法编辑该单元格。该怎么办? HTML部分
<ag-grid-angular #agGrid
[enableSorting]="true"
[rowSelection]="genericComponent.multipleRowSelection"
class="ag-theme-blue ag-grid-md-1"
[gridOptions]="gridOptionsAlert"
(rowSelected)="onRowSelection($event)"
[suppressClickEdit]="true"
[stopEditingWhenGridLosesFocus]="true"
[suppressRowClickSelection]="true"
(gridReady)="onGridReadyGroup($event)"
[components]="components"></ag-grid-angular> `enter code here`
TS部分
{ headerName: 'New Value', field: 'NewValue', filter: 'agNumberColumnFilter',cellStyle:{ 'text-align': "right" }, width: 122 ,editable:false}
onRowSelection(event){
this.colDef [8] .editable = true }
答案 0 :(得分:1)
您可以使用function
进行属性定义:
editable: (params)=>{
let result = (Math.random()>0.5)? 1 : 0;// random true/false condition
return result;
}
或
editable: this.checkEditable.bind(this)
checkEditable(params){
....
}