This is a migrated thread and some comments may be shown as answers.

[Solved] Any way to make sorting 2 state, not 3 state?

6 Answers 164 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Michael
Top achievements
Rank 1
Michael asked on 30 Sep 2010, 02:39 PM
I have "sortable" enabled on an grid bound by Ajax.  I click a column header once, sorts ascending.  Twice, descending.  Three times, not-sorted.  I should be able to shift back and forth between ascending and descending without reverting to an unsorted state.

Is this a bug, or is there some way to disable the 3rd "unsorted" state?

6 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 30 Sep 2010, 03:34 PM
Hi Michael,

 By design the grid moves to unsorted state. Currently binary sorting mode (sorted / unsorted) is not supported.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Mattias
Top achievements
Rank 1
answered on 14 Dec 2010, 01:39 PM
+ 1 vote for this
0
Pat
Top achievements
Rank 1
answered on 20 Jan 2011, 01:44 AM
+2
0
Randy
Top achievements
Rank 1
answered on 12 Mar 2011, 02:13 AM
I do not particularly like this "design".

How about an option to make it either ascending or descending?

Randy
0
Atanas Korchev
Telerik team
answered on 14 Mar 2011, 08:34 AM
Hello,

 Thank you for your feedback. We will consider this as a feature request and will implement it in a future release.

Regards,
Atanas Korchev
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
keymmachine
Top achievements
Rank 1
answered on 23 Mar 2011, 08:02 PM
So I created a workaround for this issue. What I did was, using the jQuery Query String plugin, I replaced the "no-state" sort ("~") with the next ascending sort on page load.  The one catch with this is if your default sort is descending then you need to hardcode the next sort on that specific column.

Here is my code for a grid with a default descending column (CreatedDate in my case):

$(function () {
    var order = $.query.get('orderBy') == "" ? "CreatedDate-asc" : $.query.get('orderBy').replace("-desc", "-asc");
    var orderstring = $('.t-sorted a').attr('href').replace("~", order);
    $('.t-sorted a').attr('href', orderstring);
});

Here is the code for a grid with a default ascending column:

$(function () {
    var order = $.query.get('orderBy').replace("-desc", "-asc");
    var orderstring = $('.t-sorted a').attr('href').replace("~", order);
    $('.t-sorted a').attr('href', orderstring);
});

Hopefully this might help a few people.

Andrew
Tags
Grid
Asked by
Michael
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Mattias
Top achievements
Rank 1
Pat
Top achievements
Rank 1
Randy
Top achievements
Rank 1
keymmachine
Top achievements
Rank 1
Share this question
or