Posted 9 January 2019, 3:02 am EST - Updated 3 October 2022, 8:13 pm EST
Hi,
I have following JSON object which we need to use to write it to a flexgrid. I am able to create the columns, populate but not getting a hint on how to populate the baseline array into each row.
HTML:
<wj-flex-grid [itemsSource]="data">
<wj-flex-grid-column [header]="'Icon'" [binding]="'Icon'" align="center"></wj-flex-grid-column>
<wj-flex-grid-column [header]="'Name'" [binding]="'Name'" align="center"></wj-flex-grid-column>
<wj-flex-grid-column [header]="'Start'" [binding]="'BeginOffset'" align="center"></wj-flex-grid-column>
<wj-flex-grid-column [header]="'End'" [binding]="'EndOffset'" [format]="'n0'" align="center"></wj-flex-grid-column>
<wj-flex-grid-column [header]="'PaidHours'" [binding]="'PaidHours'" align="center"></wj-flex-grid-column>
<wj-flex-grid-column [header]="'Period'" [binding]="'Period'" align="center"></wj-flex-grid-column>
<wj-flex-grid-column *ngFor="let cell of baselineKeys"
[header]="cell"
[binding]="cell">
</wj-flex-grid-column>
</wj-flex-grid>
TS File:
public data: wjCore.CollectionView;
constructor(@Inject(DataService) dataSvc: DataService) {
console.log("this products");
dataSvc.get_products().subscribe((res : any[])=>{
console.log(res);
this.baselineKeys = this.getBaseline(res);
this.finalBaselineJson = this.prepareBaseline(res, this.baselineKeys)
this.data = new wjCore.CollectionView(res);
});
}
[
{
"Baseline": [ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ],
"BeginOffset": 420,
"ConfigIndex": 0,
"EndOffset": 900,
"Icon": "D",
"Name": null,
"PaidHours": 7.5,
"Period": "D"
}]