<ejs-treegrid #treegrid [dataSource]='data' height='359' width='auto' childMapping='Children' [treeColumnIndex]='0' >
<e-columns>
. . .
<e-column headerText='Tax per annum' width='90' textAlign='Center'>
<ng-template #template let-data>
<ejs-dropdownlist id='games' #sample [dataSource]='sportsData' (change)='onChange($event)' [value]='value' [fields]='fields'></ejs-dropdownlist>
</ng-template>
</e-column>
</e-columns>
</ejs-treegrid>
declare var myMethod: any;
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
})
export class AppComponent {
public data: Object[] = [];
public sparkData: Object[] = [];
public sportsData: Object[] = [
{ Id: 'Game1', Game: 'American Football' },
{ Id: 'Game2', Game: 'Badminton' },
];
public fields: Object = { text: 'Game', value: 'Id' };
@ViewChild('treegrid')
public treegrid: TreeGridComponent;
ngOnInit(): void {
this.data = textdata;
myMethod();
}
public onChange(args: any): void {
let value: Element = document.getElementById('value');
let text: Element = document.getElementById('text');
}
// custom code end
} |