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

'Natural Sort' Question?

5 Answers 74 Views
GridView
This is a migrated thread and some comments may be shown as answers.
SUNIL
Top achievements
Rank 2
SUNIL asked on 25 Feb 2011, 10:38 PM
I have seen following explanation in the documentation for RadGrid:

"By default, clicking a third time returns to a natural sort (i.e. no sorting). No arrow is displayed on the column heading. Note: The property settings for the grid may disallow the natural sort."

My question is: What settings for the grid may disallow natural sort?

I am using Q1 2008 SP1 version , but I guess this question would apply in the same way to all versions.

Thanks
Sunil

5 Answers, 1 is accepted

Sort by
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 26 Feb 2011, 12:04 PM
Hello Sunil,

If i understood correctly the third time you click a column header no sort will be applied. Sadly this is not the case in the latest versions of the telerik grid, in the newer versions the first click is ascending, second descending and third ascending again.... I have a few ideas on how this could be avoided but sadly i cannot perform any test without having that version.

But i would suggest you handle the sort changing event, and check the Action property of the event args (if it's available), or if not just check the sort descriptors and once you figure out what that action is just apply a different sort descriptor on the grid and this, should, solve your problem.

If you have any other questions i would be more than happy to assist in any way that i can.

Best Regards,
Emanuel Varga

Telerik WinForms MVP
0
SUNIL
Top achievements
Rank 2
answered on 03 Mar 2011, 05:12 PM
Hi Emanuel,

Thanks for your help.
I just gave up trying to implement natural sorting, since one would have to keep track of number of times each column is sorted that would consume extra memory. This meant I need  a collection object like List<int> or Dictionary<string, int>, where I track by column unique name the number of times a column has been sorted. This would just consume extra memory, so I gave up.

Thanks
Sunil
0
Richard Slade
Top achievements
Rank 2
answered on 03 Mar 2011, 05:19 PM
Hello Sunil,

As far as I know, the natural sort (back in your version of RadControls) can be applied by setting
this.radGridView1.MasterGridViewTemplate.AllowNaturalSort = true;

As Emanuel has said, this is not in the later versions of RadControls, but I think it may apply to your version
Hope that helps
Richard
0
SUNIL
Top achievements
Rank 2
answered on 03 Mar 2011, 09:22 PM
Hi Richard,

I tried doing that before creating this forum thread, but it did not help.

Thanks
Sunil
0
Richard Slade
Top achievements
Rank 2
answered on 03 Mar 2011, 09:32 PM
Ok. Well, like Emanuel I am running the latest version. It was worth a try in case you hadn't seen it though. Richard
Tags
GridView
Asked by
SUNIL
Top achievements
Rank 2
Answers by
Emanuel Varga
Top achievements
Rank 1
SUNIL
Top achievements
Rank 2
Richard Slade
Top achievements
Rank 2
Share this question
or