ngx-datatable中的升序和降序排列数字列。角2/4

han*_*Man 2 ngx-datatable angular

我需要对ngx-datatable中的ID号列进行排序。我在表中也有空值,我该如何按升序获取列并最后获取空值。它从服务器上排序很好,但是当我尝试对desc排序并返回升序时,空值始终排在第一位。然后,我需要在对升序进行排序时放到最后。这是我的一些代码

Template

<ngx-datatable-column prop="ID" name="ID">
     <template let-column="column" let-sort="sortFn" ngx-datatable-header-template>
       <span (click)="sort()" class="sort-fullwidth">ID</span>
     </template>
</ngx-datatable-column>
Run Code Online (Sandbox Code Playgroud)

我不知道该排序方法的去向。我尝试了[sorts] =“” [{prop:'ID',dir:'asc']“,[comparator](但不确定我是否正确)。

谢谢

小智 7

它看起来像这样:

<ngx-datatable class='material' [columns]="columns" [rows]="rows" [columnMode]="'force'" [headerHeight]="50" [footerHeight]="50" [rowHeight]="'auto'" [limit]="100" [sortType]="'multi'" [reorderable]="true" [sorts]="[{prop: 'ID', dir: 'asc'}]">
Run Code Online (Sandbox Code Playgroud)