https://primefaces.org/primeng/showcase/#/table
First, i want the table to initialy do the order on my column "order" : it works.
Then, the user can change the sort manually by itself for another column (like 'name')...
When the user hit the "Edit" button, he can change the order of then items.
For a better user experience and a better logic, i want to force reset the column order to it's initial form : "order".
app.component.html
<p-table [value]="values" #table sortField="order" [sortOrder]="1" sortMode="single">
<ng-template pTemplate="header">
<tr>
<th pSortableColumn="order" [pSortableColumnDisabled]="!readOnly">
ORDER
<p-sortIcon *ngIf="readOnly" field="order"></p-sortIcon>
</th>
...
</tr>
</ng-template>
<ng-template pTemplate="body">
...
</ng-template>
</p-table>
app.component.ts
//@ViewChild('table') table: Table;
@ViewChild('table', { static: false }) table: Table;
onChangeMode() {
this.table.sortMode = 'single';
this.table.sortField = 'order';
this.table.sortOrder = 1;
this.table.reset();
}
But the "reset" function seems not doing it's job here... (nothing changes)
Did i forget something ?
Thank you for your help !