We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Bad sorting with grouping


I´m trying to create DataGrid in XAML (i use xamarin.forms - with your component I have 3 columns (DateTime, Date, Value). Example: 2019-02-15 23:15:10.111, 2019-02-15 00:00:00.000, "value text"

I need implement all this parameters:
 - group by: Date (only date without show time)  - i need format: 'dd.MM.yyyy' with sort descending
 - sort by: DateTime descending
 - show column: Time (HH:mm:ss) and Value

I attach a picture with wrong sort of groups (groups are not descending by date)

How to do it?

Next question: how to translate or change string 'Items'

Can you help me or provide any sample? Thx

My code: 

                <syncfusion:SfDataGrid x:Name="DataGridAlarms" ColumnSizer="Star" AutoGenerateColumns="False" RowHeight="25" SelectionMode="Single" AutoExpandGroups="False" AllowGroupExpandCollapse="True" QueryRowHeight="DataGridAlarms_QueryRowHeight">

                        <syncfusion:GroupColumnDescription  ColumnName="Date"  />

                    <syncfusion:SfDataGrid.Columns x:TypeArguments="syncfusion:Columns">

                        <syncfusion:GridDateTimeColumn MappingName="Date" HeaderText="Date" Format="dd.MM.yyyy" IsHidden="True" GroupMode="Display" SortMode="Value" AllowSorting="True" >

                        <syncfusion:GridDateTimeColumn MappingName="DateTime" Format="HH:mm:ss" HeaderText="Time" AllowSorting="True"Width="65" >
                        <syncfusion:GridTextColumn MappingName="Text" HeaderText="Value" AllowSorting="True">


                        <syncfusion:SortColumnDescription ColumnName="DateTime" SortDirection="Descending" />


Attachment: DataGrid_c372c3f7.zip

5 Replies

SP Subburaj Pandian Veluchamy Syncfusion Team February 18, 2019 12:40 PM UTC

Hi Tomas, 
Thank you for contacting Syncfusion support. 
Query 1: Group column in descending order. 
Based on the provided information, we checked your requirement “How to sort the grouped column in descending” in default grouped column will be sorted in ascending format. If you want to sort the grouped column in descending order you have add that column in DataGrid sort Description as in the following code example. 
<sfgrid:SortColumnDescription ColumnName="Date" SortDirection="Descending" /> 
We have attached the sample for your reference. 
Query 2: How to translate or change string 'Items' 
We are unable understand your query clearly, can you provide more details about this query to provide you the better solution. 
Subburaj Pandian V   

TT Tomas Turek February 19, 2019 08:40 AM UTC

Thank you for quick reply with a sample.

1) I tried your code, but if I changed items (change date and datetime range to a longer period) the groups are still not descending by date (only descending by start numbers). I added sample and picture(1 and 2).

Descending groups by date working only if I use - [GroupMode="Value"] (not Display) - but if I do it, groups contain unwanted time "0:00:00" (picture 3)

2) Translate word 'items' in grouping - I want to change this word (I want to translate it to another language)

Current: Date : 21.10.2019 - 2 Items
I want: Date : 21.10.2019 - 2 Položky (Záznamy,...)

Attachment: Samples_2019_02_19_6a1e2175.zip

SP Subburaj Pandian Veluchamy Syncfusion Team February 20, 2019 11:51 AM UTC

Hi Tomas, 
Thank you for the update. 
Query 1: Need to display Date alone in caption summary row and Group mode  
We have checked your query and created a sample based on your requirement. In that we have displayed Date alone without time in caption summary row and used Group Mode as value and we have achieved this requirement using Custom aggregate in summary row.  
Please find the sample by the following link,  
Please refer the following UG for more details to customizes summary row, 
Query 2:  Regarding localization of string “Items”. 
Please translate the word Items based on the language and Concat or append the string with Summary Title. 
string translate = "Items"; 
GridSummaryRow summaryRow = new GridSummaryRow(); 
summaryRow.Title = "Date : {CaptionSummary} " + translate; 
summaryRow.ShowSummaryInRow = true; 
summaryRow.SummaryColumns.Add(new GridSummaryColumn 
    Name = "CaptionSummary", 
    CustomAggregate = new CustomAggregate(), 
    MappingName = "Date", 
    Format = "{Date}", 
    SummaryType = Syncfusion.Data.SummaryType.Custom 
dataGrid.CaptionSummaryRow = summaryRow; 
Please let us know, if you need further assistance on this.  
Subburaj Pandian V  

TT Tomas Turek February 21, 2019 09:20 AM UTC

Thank you very much. Now everything works perfectly.

SP Subburaj Pandian Veluchamy Syncfusion Team February 21, 2019 09:25 AM UTC

Hi Tomas, 
Thank you for the update. We are happy that the given solution meets your requirement. 
Please get in touch with us if you would require any further assistance. 
Subburaj Pandian V  

Live Chat Icon For mobile
Up arrow icon