2017-10-19 107 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) –