I'm currently working on a Kendo Grid (UI for Jquery) where I have implemented a custom sort method for a specific column based on my customers' requirements.
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;
}
}
I have replicated the same grid in Kendo UI for Angular, using Angular 6, and everything is working well except for the custom sort method mentioned above. All other columns are sorting correctly using the standard method.
<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)"
>
This is the function I am currently using for dataStateChange:
public dataStateChange(state: DataStateChangeEvent): void {
this.state = state;
this.view = process(this.items, this.state);
}
I am wondering if it is possible to achieve the same custom sorting functionality in Kendo UI for Angular.