how to get selected rows values in angular infragistics grid UI

925 Views Asked by At

I'm using angular Infragisics grid in angular typescript 12 and I want to display all the selected rows from the igx-grid when I click a button.

Here is what I tried but I get an empty array and no data is displayed.

Here is the HTML code

<igx-grid 

#grid id="grid" [rowSelection] ='"multiple"'  primaryKey="prID" rowHeight="35px" displayDensity="compact" [data]="listeproduits"  [autoGenerate]="false" height="380px" [allowFiltering]="true" >

 <igx-column  field="code"  header="Code"></igx-column>
 <igx-column  field="name"   header="name"></igx-column>

 </igx-grid>

and here is where I try to print the selected value


export class productComponnet implements OnInit {

  @ViewChild("grid") public grid!: IgxGridComponent;

selected_rows()
  {
    console.log(this.grid.selectedRows);
  }
}

0

There are 0 best solutions below