Skip to content
Advertisement

how to enable selected cell in angular table?

The cell that is currently been clicked should be the only cell opened and focus, and when I click other cell the previous one should close, right now I can open and click multiple sunsetDate cells at a time which is wrong.

How do we handle this in angular?

#screenshot

enter image description here

#html code

JavaScript

#ts code

JavaScript

#sample object being passsed when cell is clicked

JavaScript

Advertisement

Answer

Instead use “data.editing” use a variable

JavaScript

So, you use:

JavaScript

In your function

JavaScript

When you end editing, simply

JavaScript

(*)If you has a *ngFor you simplly use

JavaScript

If you’re using mat-table, see that you use

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement