<ejs-grid #grid [dataSource]='data' [allowSorting]='true'>
<e-columns>
<e-column field='Freight' [sortComparer]='sortComparer' headerText='Freight' width='120' textAlign='Right'></e-column>
</e-columns>
</ejs-grid> |
// Sort comparer function
sortComparer(reference: string, comparer: string) {
// This will be triggered for comparing each value with the reference value
// This can be customized to compare the values as per your need and return the corresponding result
if (reference < comparer) {
return -1;
}
if (reference > comparer) {
return 1;
}
return 0;
} |