【发布时间】:2018-12-03 22:36:58
【问题描述】:
我在 Kendo Grid(Jquery 的 UI)中有以下列,并根据我的客户的需求使用特殊的排序方法。
field: "daysLeft",
title: "Accessible",
width: 130,
sortable: {
compare: function (a, b, descending) {
if (a.daysLeft == 'Not started') return 1;
if (b.daysLeft == 'Not started') return -1;
if (a.end < b.end) return -1;
if (a.end > b.end) return +1;
return 0;
}
}
我已经使用 Angular 6 在 Kendo UI 中为 Angular 构建了相同的网格,除了上面的这种排序方法之外,我已经完成了所有工作。所有其他列都使用标准排序。
<kendo-grid class="m-2"
[data]="view"
[pageSize]="pageSize"
[skip]="skip"
[pageable]="gridSettings()"
filterable = "menu"
[filter]="state.filter"
[height]="450"
[sortable]="{
allowUnsort: true,
mode: multiple ? 'multiple' : 'single'
}"
[sort]="state.sort"
(pageChange)="pageChange($event)"
(dataStateChange)="dataStateChange($event)"
>
我当前的dataStateChange函数:
public dataStateChange(state: DataStateChangeEvent): void {
this.state = state;
this.view = process(this.items, this.state);
}
是否可以在 Kendo UI for Angular 中实现这一点?
【问题讨论】:
-
目前无法提供自定义
compare函数。但UserVoice Portal 中已有一张票,您可以投票。
标签: angular typescript kendo-ui kendo-ui-angular2