<ejs-grid [dataSource]='data'>
<e-columns>
<e-column field='XML' width='120'>
<ng-template #template let-data>
<div style="height:55px">{{data.XML}}</div>
</ng-template>
</e-column>
</e-columns>
</ejs-grid>
|
<ng-template #template let-data>
<div style="height:55px">{{data.XML}}</div>
</ng-template>
<ejs-grid [dataSource]='data' [columns]="gridColumns">
</ejs-grid>
export class DefaultComponent implements OnInit {
...
public gridColumns: Object[];
@ViewChild('template')
public template: Object;
....
ngOnInit(): void {
...
this.gridColumns = [{
field: 'XML',
template: this.template // Programmatically assigned
}];
}
}
|
export class DefaultComponent implements OnInit {
. . . . .
ngAfterViewInit(): void {
let j = 0;
setInterval(() => {
for(let i = 0; i < this.gridColumns.length ; i++) {
if(this.gridColumns[i]["field"] == "XML") {
this.gridColumns[i]["template"] = j % 2 === 0 ? this.template : this.template5;
this.gridColumns[i]['templateFn'] = templateCompiler(this.gridColumns[i]["template"]);
}
}
this.grid.refreshColumns();
j++;
}, 3000)
}
}
|