Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
142336 | Jan 29,2019 07:41 AM UTC | Feb 11,2019 06:35 PM UTC | Angular - EJ 2 | 8 |
![]() |
Tags: Grid |
<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)
}
}
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.