When clicking on a grid column header which is sortable, the first click will sort asc, then the second click on the header will sort desc and a third click will cancel the sort
is there any way to reverse this order so the first click will sort desc, second click asc and last click no sort?
is there any way to reverse this order so the first click will sort desc, second click asc and last click no sort?
7 Answers, 1 is accepted
0
Hi Nave,
I am afraid what you would like to achieve is not supported in Kendo UI Grid. As a possible workaround I can suggest setting the initial sort options in the DataSource. For example:
Regards,
Iliana Nikolova
the Telerik team
I am afraid what you would like to achieve is not supported in Kendo UI Grid. As a possible workaround I can suggest setting the initial sort options in the DataSource. For example:
dataSource =
new
kendo.data.DataSource({
//....
sort: ({ field:
"FirstName"
, dir:
"desc"
})
});
$(
"#grid"
).kendoGrid({
//....
dataSource: dataSource
});
Regards,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Igor Stanek
Top achievements
Rank 1
answered on 03 Oct 2014, 09:20 AM
Hi!
We are very interested in this feature (the first click will sort desc, second click asc and last click no sort), too.
Is this still not supported in KendoUI grid? And if not, it is planned?
thanks,
Igor.
We are very interested in this feature (the first click will sort desc, second click asc and last click no sort), too.
Is this still not supported in KendoUI grid? And if not, it is planned?
thanks,
Igor.
0
Hi Igor,
This feature is currently not supported by Kendo UI Grid. Actually this idea has been submitted as a feature request at our UserVoice portal - if you wish you may cast a vote, leave a comment or monitor the community's interest in it here. The more votes the suggestion collects, the higher priority will have.
Regards,
Iliana Nikolova
Telerik
This feature is currently not supported by Kendo UI Grid. Actually this idea has been submitted as a feature request at our UserVoice portal - if you wish you may cast a vote, leave a comment or monitor the community's interest in it here. The more votes the suggestion collects, the higher priority will have.
Regards,
Iliana Nikolova
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Dirk
Top achievements
Rank 1
answered on 15 Apr 2016, 10:07 AM
Hi,
I think I solved this problem by modifying the DOM elements responsible fo column sorting.
In endRequest event of the dataSource the following function is executed:
function reverseSortOrderSequence() {
setTimeout(function() {
var colSortHeaders = $("#gridId [data-role='columnsorter']");
$.each(colSortHeaders, function(index, item) {
if ($(item).attr("data-dir") === undefined) {
$(item).attr("data-dir", "asc");
} else if ($(item).attr("data-dir") === "asc") {
$(item).attr('data-dir', 'desc');
} else if ($(item).attr("data-dir") === "desc") {
$(item).attr('data-dir', null);
}
});
});
}
This reverts the sort order sequence to: none->desc->asc->none...
HTH
Dirk
0
Dirk
Top achievements
Rank 1
answered on 15 Apr 2016, 10:11 AM
I forgot to tell that
this solution is more or less a 'hack' since it uses manipulating DOM instead of using
API and may not work with future version of the kendo lib.
0
Saranya
Top achievements
Rank 1
answered on 27 Apr 2016, 11:34 PM
I will be hooking into the dataBinding method and testing the number of dataBind events that this triggers. Would this be the preferred method as apposed to hacking the DOM and causing reflow / redraw?
0
Hi Saranya,
We are not aware of a good and universal approach which we could suggest, however I will leave this forum thread open for someone from the community to be able to get involved.
Regards,
Iliana Nikolova
Telerik
We are not aware of a good and universal approach which we could suggest, however I will leave this forum thread open for someone from the community to be able to get involved.
Regards,
Iliana Nikolova
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!