Issue
I've read through every online post I could find about about sorting with the Kendo Grid. Basically I'm trying to find a way to sort by descending first and then ascending after. I know how to set a default sort as descending when the grid loads, but I need this to happen any time a field is sorted. If there is no sort, it should sort by descending first.
sortable: {
allowUnsort: false
SortByDescendingFirst: true <== Something like this
},
Solution
I don't think there's an option to define that - you can try something like this (this is for Q1 2014, in older versions you can do the same but you have to modify kendo.ui.Sortable.fn._click
instead):
kendo.ui.Sorter.fn._click = function (originalFn) {
return function (e) {
var element = this.element,
dir = element.attr(kendo.attr("dir"));
if (!dir) element.attr(kendo.attr("dir"), "asc");
if (dir === "desc") element.attr(kendo.attr("dir"), "");
if (dir === "asc") element.attr(kendo.attr("dir"), "desc");
originalFn.call(this, e);
};
}(kendo.ui.Sorter.fn._click);
Answered By - Lars Höppner
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.