|
Default.html
<ejs-grid #grid [dataSource]='data' [allowPaging] = 'true'>
<e-columns>
<ng-template #template ngFor let-column [ngForOf]="columns">
<e-column [field]="column.field"
[headerText]="column.headerText"
[allowEditing]="column.allowEditing"
[isPrimaryKey]="column.isPrimaryKey != null ? column.isPrimaryKey : null"
[width] = "column.width" >
</e-column>
</ng-template>
</e-columns>
</ejs-grid>
<ng-template let-data #template2>
<a rel='nofollow' rel='nofollow' href="#">{{data.FirstName}}</a>
</ng-template>
|
|
Default.component.ts
export class DefaultComponent implements OnInit {
public data: Object[] = [];
public gridData: any;
public template: any;
@ViewChild('template2')
public temp2: NgModel;
@ViewChild('grid')
public grid: Grid;
public columns: any;
ngOnInit(): void {
this.data = employeeData;
this.columns = [{ field: "EmployeeID", isPrimaryKey: "true", headerText: "Employee ID", width: "90" },
{ field: "FirstName", headerText: "First Name", width: "90" },
{ field: "LastName", headerText: "Last Name", width: "90", allowEditing: false },
{ field: "Country", headerText: "Country", width: "90" }]
}
ngAfterViewInit(): void {
(this.grid.getColumns()[2].template as any) = this.temp2;
}
}
|