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

AllowCustomSorting not working for grouped columns

3 Answers 76 Views
Grid
This is a migrated thread and some comments may be shown as answers.
JP
Top achievements
Rank 1
JP asked on 11 Jul 2018, 06:40 AM

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!

3 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 16 Jul 2018, 06:25 AM
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.
0
JP
Top achievements
Rank 1
answered on 18 Jul 2018, 06:54 AM

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!

 

 

0
Eyup
Telerik team
answered on 23 Jul 2018, 04:53 AM
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.
Tags
Grid
Asked by
JP
Top achievements
Rank 1
Answers by
Eyup
Telerik team
JP
Top achievements
Rank 1
Share this question
or