Code: Select all
<p-dataTable *ngIf="ShowTable" [value]="List?.Value?.Items" [lazy]="true" [rows]="Rows"
[paginator]="true" [totalRecords]="List?.Value?.TotalCount" (onLazyLoad)="OnLoadLazy($event)"
selectionMode="single" (onRowSelect)="OnRowSelect($event)" sortField="Name" sortOrder="1">
<p-column field="Id" header="Id" [filter]="true" [sortable]="true" style="width:70px"></p-column>
<p-column field="Name" header="Name" [filter]="true" [sortable]="true"></p-column>
</p-dataTable>
Code: Select all
{"Page":1,"PageSize":5,"TotalCount":10,
"Items":[
{"Id":18,"Name":"adsfdsafdsafsadf"},
{"Id":10,"Name":"asdf"},
{"Id":11,"Name":"asdf"},
{"Id":9,"Name":"blubbasdfsaasdf"},
{"Id":1,"Name":"FirmaB"}
]}
But the Datatable changes this order to
{"Id":1,"Name":"FirmaB"},
{"Id":18,"Name":"adsfdsafdsafsadf"},
{"Id":10,"Name":"asdf"},
{"Id":11,"Name":"asdf"},
{"Id":9,"Name":"blubbasdfsaasdf"}
When paging for and backward the sortorder is correct. Only the initial load shows this strange behavior.