🎃

[wip]angular ラジオボタンで有効切替

2024/10/20に公開

ラジオボタンのイベント

html

<p-radioButton ... [(ngModel)]="selectedCategory" (onClick)="clickRadio()" />

ts

selectedCategory: any = null;
flag: boolean = true;

ngOnInit() {
  console.log('[ngOnInit] execute');
  this.selectedCategory = this.categories[0];
  this.setCurrentClasses();
}

clickRadio() {
  this.flag = this.selectedCategory.key == 'A';
}

有効切替

disabledをflagで切り替える。

<p-radioButton ... [disabled]="flag" />

ag-grid チェックボックス無効化

gridOptions: GridOptions = {
  rowSelection: {
    mode: 'multiRow',
    headerCheckbox: false,
    checkboxes: (params) => false,
  },
}

https://www.ag-grid.com/javascript-data-grid/row-selection-multi-row/#force-checkboxes-to-be-selected

Discussion