'Natural Sort' Question?

6 posts, 1 answers
  1. Sunil
    Sunil avatar
    230 posts
    Member since:
    Jan 2004

    Posted 25 Feb 2011 Link to this post

    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
  2. Answer
    Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 26 Feb 2011 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Sunil
    Sunil avatar
    230 posts
    Member since:
    Jan 2004

    Posted 03 Mar 2011 Link to this post

    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
  5. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 03 Mar 2011 Link to this post

    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
  6. Sunil
    Sunil avatar
    230 posts
    Member since:
    Jan 2004

    Posted 03 Mar 2011 Link to this post

    Hi Richard,

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

    Thanks
    Sunil
  7. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 03 Mar 2011 Link to this post

    Ok. Well, like Emanuel I am running the latest version. It was worth a try in case you hadn't seen it though. Richard
Back to Top
UI for WinForms is Visual Studio 2017 Ready