Cannot see the data being displayed. Here is the code snippet: Click here to view the code
list.component.ts
setAgGrid() {
this.data.map((data: any) => {
const date = new Date(data.date);
const year = ('' + date.getFullYear()).slice(-2);
const assetColIndex = data.assetCode + '_' + date.getMonth() + '_' + year;
if (this.columns.indexOf(assetColIndex) === -1) {
this.columns.push(assetColIndex);
}
});
const dataByMonthYr = this.data.reduce((dataByMonthYear: any, datum: any) => {
// Code continues here...
}, []);
this.columnDefs.sort((a: any, b: any) => {
if (a.code < b.code) { return -1; }
return 0;
});
console.log(this.columnDefs, dataByMonthYr);
this.rowData.next(dataByMonthYr);
}
How can I display the objects in ag grid?
I want the output to look like this: https://i.sstatic.net/dJpQZ.png
When trying to add
this.gridOptions.gridApi.setRowData(object)
, the gridApi or setRowData function is not recognized.
Expected output:
https://i.sstatic.net/AYrFi.png
Thank you in advance.