I am having trouble with the following code snippet:
Why is the year not being passed to the initGridOptions
function? How can I ensure that it is properly visible there?
I attempted to make it public but that approach did not yield the desired result.
I'm uncertain whether it's necessary to keep the initGridOptions
function private.
export class JobTimePhasingComponent implements OnInit, ComponentHasUnsavedChanges {
public key: string = "timePhasing";
public year: string;
job: JobViewModel;
constructor(
private router: Router,
private toastr: ToastsManager
) {
this.initGridOptions();
}
ngOnInit(): void {
this.refresh();
}
private initGridOptions(): void {
...
colDefs.push({
headerName: this.year, (UNDEFINED)
field: "data.Total",
valueGetter: cellTotalValueGetter,
width: 100,
});
}
refresh(): void {
let jobId = +this.route.snapshot.parent.params['id'];
this.jobService.getJob(jobId).then(result => {
this.fy = result.Object.FinancialYearName;
});
}