Home > OS >  Angular 14 mat-checkbox not clickable
Angular 14 mat-checkbox not clickable

Time:11-19

I got an app that uses a schema to define the columns of an editable mat-table.

The problem is that when I click the pencil, the checkboxes aren't clickable. For more details, I suggest you go see the stackblitz project.

enter image description here

In editing mode :

enter image description here

CodePudding user response:

The example is in Angular 15

change the following thing, this should make the checkbox work

<tr
  mat-row
  *matRowDef="let row; columns: displayedColumns"
  (click)="clickedRows.add(row)"
  [class.highlightTableColor]="clickedRows.has(row)"
></tr>
clickedRows = new Set<model>();

or remove the return statement from the highlight method

highlight(row: { ID: number }) {
  if (!this.editing) this.selectedID = row.ID;
}
  • Related