I have a ngx-datatable with 4 data columns and one column with a delete button for remove the row from the table as below.

HTML code
<ngx-datatable
*ngIf="!isLoading"
#table
class="data-table"
[scrollbarH]="true"
[rows]="data"
[columnMode]="'force'"
[headerHeight]="50"
[footerHeight]="50"
[rowHeight]="'auto'"
[limit]="limit"
[selected]="selected"
[selectionType]="'single'"
(select)='onSelect($event)'>
    <ngx-datatable-column *ngFor="let columnData of columns" name={{columnData.name}} prop={{columnData.prop}}>
       <ng-template let-column="column" let-sort="sortFn" ngx-datatable-header-template>
          <span class="datatable-header-column datatable-header-cell-label" (click)="sort()"><i class="{{columnData.icon}}" ></i> {{columnData.name}}</span>
       </ng-template>
    </ngx-datatable-column>
    <ngx-datatable-column [sortable]="false" [maxWidth]="70">
        <ng-template let-column="column"  let-row="row" ngx-datatable-cell-template>
            <button class="btn btn-danger btn-mini" *ngIf='!row.unAssigning' (click)="onDelete(row, column)">
                <i class="icofont icofont-trash"></i>
            </button>
            <img class="mini-spinner" *ngIf="row.unAssigning" src="../assets/img/busy-red.gif">
        </ng-template>
    </ngx-datatable-column>     
</ngx-datatable>
TS file
onSelect({
    selected
}) {
    this.router.navigate(['/update', selected[0].id]);
}
Currently when select a row, redirecting user to another page. But I need to remove the redirecting feature when click on the delete button in the table. Redirect must perform only when click on a data columns.
How can I achieve this?
If i understood your problem you want to press the delete button without redirecting the user with the onSelect function.
You can try the following code:
<button class="btn btn-danger btn-mini" *ngIf='!row.unAssigning' (click)="$event.preventDefault(); $event.stopPropagation(); onDelete(row, column)">
    <i class="icofont icofont-trash"></i>
</button>
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With