I'm having trouble disabling a checkbox that is loaded dynamically upon a action.
I'm using a CellRendererFramework with a custom component for loading basic grid data, below is my columnDef for the same. I have an event outside ag-grid when I check that checkbox I'm inserting dynamic row data to the grid. when doing so if that row data's state column value is false then I have to disable the checkbox and radio button of that specific row.
Here I'm able to find rowNodeId of the new row but I'm unable to make the checkbox and radio disabled:
{ headerName: 'abc', field: 'abc'},
{ headerName: 'State', field: 'state'},
{
headerName: 'check Case',
field: 'checkCase',
cellRendererFramework: GridCheckboxRendererComponent,
onCellValueChanged: (event: CellValueChangedEvent) => {
this.updateCaseCheck(event);
},
cellRendererParams: {
disableCaseCheckbox: this.disableWhenCaseisArchived
}
},
{
headerName: 'Make Default',
field: 'makeDefault',
cellRendererFramework: GridRadioButtonRendererComponent,
onCellValueChanged: (event: CellValueChangedEvent) => {
this.setDefault(event);
},
cellRendererParams: {
disableDefaultRadio: this.disableWhenCaseisArchived
}
}
I tried using the custom cell renderer param but it is only setting while the grid is instantiating.
I'm setting data using gridApi, like below and caseRowData will have previous and post event new data:
this.gridApi.setRowData(this.caseRowData);
Inside my custom grid checkbox and radio components in agOninit I'm mapping this custom renderer value and the same is mapped to disable attribute on checkbox and radio inputs respectively.
Any help is highly appreciated.
Inside your cellRendererFramework component i.e.,GridCheckboxRendererComponent
or GridRadioButtonRendererComponent
you could use the data property that comes within params
class CellRenderer implements ICellRendererParams {
public disableCheckbox: boolean;
agInit(params: ICellRendererParams): void {
this.disableCheckbox= params.data.state;
}
}
Now you can use this disableCheckbox
variable to disable attribute mapping on html.