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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Bad sorting with grouping

Thread ID:

Created:

Updated:

Platform:

Replies:

142702 Feb 15,2019 03:05 PM UTC Feb 21,2019 09:25 AM UTC Xamarin.Forms 5
loading
Tags: SfDataGrid
Tomas Turek
Asked On February 15, 2019 03:05 PM UTC

Hi,

I´m trying to create DataGrid in XAML (i use xamarin.forms - with your component 16.4.0.53). 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">

                    <!--Grouping->
                    <syncfusion:SfDataGrid.GroupColumnDescriptions>
                        <syncfusion:GroupColumnDescription  ColumnName="Date"  />
                    </syncfusion:SfDataGrid.GroupColumnDescriptions>

                    <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>

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

                    </syncfusion:SfDataGrid.Columns>

                    <!--Sorting->
                    <syncfusion:SfDataGrid.SortColumnDescriptions>
                        <syncfusion:SortColumnDescription ColumnName="DateTime" SortDirection="Descending" />
                    </syncfusion:SfDataGrid.SortColumnDescriptions>

                </syncfusion:SfDataGrid>




Attachment: DataGrid_c372c3f7.zip

Subburaj Pandian Veluchamy [Syncfusion]
Replied On 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. 
 
Regards,
Subburaj Pandian V   
 
 


Tomas Turek
Replied On February 19, 2019 08:40 AM UTC

Hi, 
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)

Example:
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

Subburaj Pandian Veluchamy [Syncfusion]
Replied On 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. 
  
[C#] 
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.  
 
Regards,
Subburaj Pandian V  


Tomas Turek
Replied On February 21, 2019 09:20 AM UTC

Thank you very much. Now everything works perfectly.

Subburaj Pandian Veluchamy [Syncfusion]
Replied On 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. 
  
Regards,
Subburaj Pandian V  


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;