I want to define of columns using a variable at the click event of tab.
But it seems like data of variable reaching late from ts to html.
Here is my code:-
In HTML:-
<ejs-tab #tabs id="tab_default" heightAdjustMode='Auto' (selected)='onTabSelect($event)'>
<e-tabitems>
<!--Creating tabs-->
<div *ngFor="let item of TabsDetails">
<e-tabitem [header]="{ 'text': item.Label }">
<ng-template #content>
<ejs-grid #overviewgrid id='overviewgrid' [dataSource]='gridDataSource' rowHeight='38' [allowSelection]='true'
height='600' width="1000px">
<e-columns>
<e-column headerText="Actions" [filter]='filterSettings' width='230'></e-column>
<div *ngFor="let item of gridColumns">
<e-column [field]="item.Label" [headerText]="item.Label" width='230'></e-column>
</div>
</e-columns>
</ejs-grid>
</ng-template>`
</e-tabitem>
</div>
</e-tabitems>
</ejs-tab>
In ts file:-
onTabSelect(args: SelectEventArgs) {
this.stepName = this.TabsDetails[args.selectedIndex];
console.log(this.stepName.Id);
//Firstly get the columns of the Grid for selected step(tab)
this._service.GetGenericGridColumnsByStepId(this.stepName.Id,10)
.subscribe(
data => {
this.gridColumns = data;
console.log(this.gridColumns);
}
);
// this.gridDataSource = data;
//this._service.GetGridDataByStepId(this.stepName.Id, 183,1,1,"","","")
// .subscribe(
// data => {
// //console.log(data);
// this.gridDataSource = data;
// }
// );
}
In the output window, it is not showing any column binding in first two tabs and then wrong columns in 3 and 4 tab.
Kindly do needful.