|
[app.component.html]
<ejs-grid #grid [dataSource]='data'>
<e-columns>
<e-column headerText='Employee Image' width='150' textAlign='Center'>
<ng-template #template let-data>
<button (click)='getRowData($event)'>{{data.EmployeeID}}</button>
</ng-template>
</e-column>
<e-column field='EmployeeID' headerText='Employee ID' width='125' textAlign='Right'></e-column>
<e-column field='FirstName' headerText='Name' width='120'></e-column>
<e-column field='Title' headerText='Title' width='170'></e-column>
<e-column field='ReportsTo' headerText='Reports To' width='120' textAlign='Right'></e-column>
</e-columns>
</ejs-grid>
[app.component.ts]
export class AppComponent implements OnInit {
public data: Object[];
@ViewChild('grid')
public grid: GridComponent;
ngOnInit(): void {
this.data = employeeData;
}
getRowData(args:any):void{
console.log(this.grid.getRowInfo(args.target));
}
|