RadGridView sorting does not work properly in case converters are applied

3 posts, 0 answers
  1. Tijana
    Tijana avatar
    6 posts
    Member since:
    Oct 2014

    Posted 27 Jan 2015 Link to this post

    We have a problem with column sorting in case column uses converter to display values.
    For example:
    There is a grid column:
    <telerik:GridViewDataColumn DataMemberBinding="{Binding NameToDisplay,

    Property NameToDisplay is bound to column and it may contains the following values:

    Item1, Item2… Item10, Item11… Item20, Item21…

    When converter is applied displayed values are:

    Item001, Item002… Item010, Item011… Item020, Item021…

    The problem is occurring in case sorting is applied.

    Instead of having following list of items: Item001, Item002… Item010,
    Item011… Item020, Item021… after sorting is performed we have:

    Item001, Item010, Item011… Item002, Item020, Item021…

    Apparently, sorting works based on bound data, not converted

    Please advise if there is an appropriate way to avoid this
    I cannot change values which are bound to the column and I
    would like to avoid custom sorting if it is possible.

    Thank you in advance.

  2. Maya
    Maya avatar
    4062 posts

    Posted 28 Jan 2015 Link to this post

    Hi Tijana,

    All data operations like sorting, filtering, grouping, etc. are performed based on the data bound properties. One way to go would be to set SortMemberPath property of your column and set it to another property from your business object.  You can create a ViewModel to your business object and expose another property that holds the converted values. Then you can either bind directly to it or set SortMemberPath to that specific property. 
    Other option, like you said, is to customize the sorting and implement your own custom logic. 


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. DevCraft banner
  4. Tijana
    Tijana avatar
    6 posts
    Member since:
    Oct 2014

    Posted 03 Feb 2015 in reply to Maya Link to this post

    Thank you Maya.

    We solved problem by using GridViewExpressionColumn instead of GridViewDataColumn.
Back to Top