I'm looking for a multiple delete for selected item thanks to a checkbox. I use this link https://github.com/swimlane/ngx-datatable/blob/master/demo/selection/selection-chkbox-template.component.ts to create my list. Then I created a delete button at the top of my page with this html :
<button (click)="onRemoveRow(selected)">Remove First Row</button>
<ngx-datatable
#table
class='material'
[columns]="columns"
[columnMode]="'force'"
[rowHeight]="'auto'"
[rows]='temp'
[headerHeight]="50"
[footerHeight]="50"
[limit]="5"
[rowClass]="getRowClass"
[selected]="selected"
[selectionType]="'checkbox'"
(select)='onSelect($event)'>
<ngx-datatable-column [width]="30" [sortable]="false" [canAutoResize]="false" [draggable]="false" [resizeable]="false">
</ngx-datatable-column>
<ngx-datatable-column name="Site" >
<ng-template let-value="value" let-sort="sortFn" ngx-datatable-header-template>
Site
</ng-template>
<ng-template let-value="value" ngx-datatable-cell-template>
{{ value }}
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column name="Filiere" >
<ng-template let-value="value" let-sort="sortFn" ngx-datatable-header-template>
Filiere
</ng-template>
<ng-template let-value="value" ngx-datatable-cell-template>
{{ value }}
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column name="Type" >
<ng-template let-value="value" let-sort="sortFn" ngx-datatable-header-template>
Type
</ng-template>
<ng-template let-value="value" ngx-datatable-cell-template>
{{ value }}
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column name="TypeSource" >
<ng-template let-value="value" let-sort="sortFn" ngx-datatable-header-template>
TypeSource
</ng-template>
<ng-template let-value="value" ngx-datatable-cell-template>
{{ value }}
</ng-template>
</ngx-datatable-column>
</ngx-datatable>
However, I don't succeed to use the function onRemoveRow(selected)
to deleted the selected rows. I tried to use a restriction between all rows and the selected rows but I really don't found a solution.
I'm just searching an advice or a better way to do it, if someone has an idea.