0

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.

https://stackblitz.com/edit/angular-ivy-tjsqam?file=src/app/app.component.html

Code example :

<div *ngIf="col.key != 'isEdit'">
  <input
    [type]="col.type"
    [(ngModel)]="element[col.key]"
    [checked]="GetCheckBoxValue(element, col.key)"
  />

In not editing mode :

enter image description here

In editing mode :

enter image description here

0

1 Answer 1

1

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;
}
Sign up to request clarification or add additional context in comments.

1 Comment

Can't believe it. I was looking at the wrong place obviously. It was the return false of the highlight.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.