Few days in a row I'm trying to create a dynamic mat-table from data that I retrieved trough HTTP. So far so good. I used this stackblitz as an example.
In template, table is generated like this..
<ng-container *ngFor="let column of displayedColumns$.value" cdkColumnDef="{{column}}">
<th cdk-header-cell *cdkHeaderCellDef> {{column}} </th>
<td cdk-cell *cdkCellDef="let row"> {{row.attributes[column]}} </td>
</ng-container>
Now, I have one issue. I want to be able to model data that I retrive before I put them on the table. For example, looking on this stackblitz data I want to be able to merge two columns 'Created' and 'State' to show them in one column called 'Status'
Or for example, I would like to modify date format before without using | date pipe in template.
Before:
| Created | State | # | Title
Nov 30, 2018 open 14339 fix(cdk/stepper): exported ...
After:
| Status | # | Title
Nov 30, 2018 open 14339 fix(cdk/stepper): exported ...
All this effort is to be able to create an table service in which I would pass API, and table configuration, so based on that configuration, table would be rendered... Does anyone have an idea how should I approach to this?