2017-10-19 263 views
0

我需要对ngx-datatable中的ID号列进行排序。我也有表中的空值,我如何获得列的升序,并在最后得到空。它从服务器罚款,但是当我尝试排序desc和返回上升的空值总是第一。当按升序排序时,我需要结束。这里是我的一些代码ngx-datatable中的排序数字列按升序和降序排列。 Angular 2/4

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> 

我不知道那种排序方法去的地方。我试过[sorts] =“[{prop:'ID',dir:'asc']”,[比较](但不知道我是否正确)。

谢谢

回答

0

它会是这个样子:

<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'}]"> 
+1

你能提供更详细的答案/解释。请参阅[这里](https://stackoverflow.com/help/how-to-answer) –