<ng-template #template let-data>
{{data.isOwnedBy(user)}}
<ng-template>
|
<ejs-grid #grid [dataSource]='data' rowHeight='38' height='200' width="300">
<e-columns>
<e-column field='name' headerText='Employee Name' width='200'>
<ng-template #template let-data>
<div>
<span>{{ data.name }}</span>
<span> {{helper(data)}}
</span>
</div>
</ng-template>
</e-column>
</e-columns>
</ejs-grid>
|
|
export class Item {
public constructor(public readonly name: string) {}
public testFunc(): string {
return "testFunc " + this.name;
}
}
@Component({
selector: "app-root",
templateUrl: "app.component.html",
styleUrls: ["app.component.css"]
})
export class AppComponent {
@ViewChild("grid", { static: true })
public grid: GridComponent;
public data: ReadonlyArray<any> = [new Item("Name")];
public isTheSame: boolean | undefined;
public helper(args) {
// here we can match and get the object with instance of the class
let data: any = this.grid.getCurrentViewRecords()[parseInt(args.index)];
return data.testFunc();
}
} |