AllowCustomSorting not working for grouped columns

4 posts, 0 answers
  1. JP
    JP avatar
    122 posts
    Member since:
    Aug 2011

    Posted 11 Jul 2018 Link to this post

    I'm using "AllowCustomSorting" to prevent the RadGrid from sorting the values (they are already sorted) and let it just show the sort direction.

    This works fine for "normal" columns.

     

    But if such a column is grouped, the RadGrid ignores this setting and sorts by itself.

    In my case it's a column with DateTime values (already formatted as strings) - they are already correctly sorted. But if I group this column, the RadGrid sorts the values itself, and especially for DateTime values as strings, this doesn't work correctly.

     

    How can I prevent the RadGrid from sorting grouped columns and just use them as they are? I'm on the current version (2018.1) of Telerik ASP.NET Ajax.

     

    Thanks!

  2. Eyup
    Admin
    Eyup avatar
    4025 posts

    Posted 16 Jul 2018 Link to this post

    Hello,

    Please note that sorting items and sorting groups are different. The sorting for the items only applies in the individual group separately. You can modify the sorting of the groups using the SortOrder of the corresponding GroupByField.
    <GroupByExpressions>
        <telerik:GridGroupByExpression>
            <GroupByFields>
                <telerik:GridGroupByField FieldName="ShipCountry" SortOrder="Descending" />
            </GroupByFields>
            <SelectFields>
                <telerik:GridGroupByField FieldName="ShipCountry" />
            </SelectFields>
        </telerik:GridGroupByExpression>
    </GroupByExpressions>

    I hope this will prove helpful.

    Regards,
    Eyup
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. JP
    JP avatar
    122 posts
    Member since:
    Aug 2011

    Posted 18 Jul 2018 in reply to Eyup Link to this post

    Thanks for your reply.

    Unfortunately this is not what I meant.

    I know how to apply sorting to grouped columns, but I want to know how to apply custom sorting to them (like the AllowCustomSorting for the Grid's columns).

     

    Thanks!

     

     

  4. Eyup
    Admin
    Eyup avatar
    4025 posts

    Posted 22 Jul 2018 Link to this post

    Hello,

    I'm afraid this requirement is not supported. It is possible only to sort the grid groups by the grouped field and the sorting options are Ascending, Descending or None. You have 2 options in this case:

    1. Create a datafield in your database to hold the data in the preferred sorted way, then you can use this field to sort by.

    2. Use grid hierarchy to simulate this scenario. This will allow you to use custom sorting for the master level:
    http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/hierarchy-with-templates/defaultcs.aspx

    I hope this will prove helpful.


    Regards,
    Eyup
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top