Hi Scott,
Best way to do this is to extract the points in your component's constructor, or whenever they are available, and pass them as a spread to the *ngFor defining the columns.
Something like:
export class MyComponent {
columns = [
‘producer’,
‘date’,
‘station’,
‘total’
];
production: ProductionByMonth;
constructor(private service: APIService) {
this.service.getProduction().subscribe(production => {
this.production = production;
this.production.points.forEach(element => {
this.columns.push(this.production.pointFor(element));
});
});
}
}
Then your columns would look like this:
<igx-column *ngFor="let col of columns"
[filterable]="false" [groupable]="false" [sortable]="false"
[header]="col" datatype="number" [field]="col"></igx-column>
Of course, the columns object probably wouldn't be simple array of strings.
I hope this helps!
Konstantin Dinev