dblclick being triggered even if the row is different

26 Views Asked by At

When I add 2 rows via action button too fast, it triggers the dblclick event, so it "adds" 3 rows.

And the second problem is when I click on two different lines too fast, it triggers the dblclick too, event if the rows aren't the same being clicked.

Example:

            <table mat-table [dataSource]="dataSource">
                <ng-container matColumnDef="column">
                    <th mat-header-cell *matHeaderCellDef> header </th>
                    <td mat-cell *matCellDef="let row"> {{row.column}} </td>
                </ng-container>
                <ng-container matColumnDef="actions">
                    <th mat-header-cell *matHeaderCellDef> </th>
                    <td mat-cell *matCellDef="let row"> <button mat-icon-button
                            (click)="add(row)"><mat-icon>add</mat-icon></button> </td>
                </ng-container>
                <tr mat-header-row *matHeaderRowDef="['column']"></tr>
                <tr mat-row *matRowDef="let row; columns: ['column'];" (click)="select(row)" (dblclick)="add(row)"></tr>
            </table>
0

There are 0 best solutions below