I think my Problem is that the API delivers an Object instead of an array. So i need to Modify the Object to be an Array ?
How could this be done ? Object.assign ? Or Pipe ? Does anyone have a proper example ? I'am still learning Angular this is my second Project so i need some help ;)
thy so far !
Here is my code
getting data from API ..cant change the API it delivers an Object …
我有一个PrimeNG表,一切正常。我已经实现了排序。
我得到的是表中每个列的排序选项,但是我只希望在特定列中使用此选项。
有什么建议吗?
事先感谢
|| 威利..
<p-table [columns]="wikiCols" [value]="wikiItems" selectionMode="single" [(selection)]="selectedItem">
<ng-template pTemplate="header">
<tr>
<th *ngFor="let col of wikiCols" [pSortableColumn]="col.field" >
{{col.header}}
<p-sortIcon [field]="col.field" ariaLabel="Activate to sort" ariaLabelDesc="Activate to sort in descending order" ariaLabelAsc="Activate to sort in ascending order"></p-sortIcon>
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-rowData let-columns="columns">
<tr [pSelectableRow]="rowData">
<td *ngFor="let col of wikiCols">
{{rowData[col.field]}}
</td>
</tr>
</ng-template>
</p-table>
Run Code Online (Sandbox Code Playgroud)