vendredi 8 janvier 2021

unable to pass individual rows in console through ngx table using checkbox

i am able to pass all the rows at once in console but unable to pass individual row.

here is my code:---- html file:--------------------

<ngx-datatable #table class="material" style=" box-shadow:none;" [limit]="5" [selected]="selected"
      (select)="onSelect($event)" [headerHeight]="50" [footerHeight]="50" [rows]="filteredData" rowHeight="auto">
      <ngx-datatable-column [width]="40" [sortable]="false" [canAutoResize]="false" [draggable]="false"
        [resizeable]="false">

        <ng-template ngx-datatable-header-template let-value="value" let-allRowsSelected="allRowsSelected"
          let-selectFn="selectFn">
          <input type="checkbox" [checked]="allRowsSelected" (change)="selectFn(!allRowsSelected)" />
        </ng-template>

        <ng-template ngx-datatable-cell-template let-value="value" let-isSelected="isSelected"
          let-onCheckboxChangeFn="onCheckboxChangeFn">
          <input type="checkbox" [checked]="isSelected" (change)="onCheckboxChangeFn(!isSelected)" />
        </ng-template>

      </ngx-datatable-column>

      <ngx-datatable-column [width]="150" *ngFor="let column of columns" [prop]="column.prop" [name]="column.name"
        [sortable]="false">
      </ngx-datatable-column>
    </ngx-datatable>

.ts code:------

onSelect({ selected }:any) {
    console.log('Selected Rows',selected,this.selected);
    this.selected.splice(0, this.selected.length);
    this.selected.push(...selected);
  }



Aucun commentaire:

Enregistrer un commentaire