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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid Grouping format date while grouping by

Thread ID:

Created:

Updated:

Platform:

Replies:

132149 Aug 16,2017 07:04 PM UTC Aug 17,2017 08:51 AM UTC WinForms 1
loading
Tags: GridGroupingControl
Josip Pejakovic
Asked On August 16, 2017 07:04 PM UTC

Hello

I have two questions:

1. How to format date while grouping by column? In normal view I have cell with datetime but when grouping data by that column i want to eliminate time display (see attachment)

2. I have query that look like this:

SELECT field1, field2, field3, DATE_FORMAT(field3, '%d.%m.%Y') AS ColOnlyDate FROM myTable

In table descriptor there are 4 columns mapped according to fields in select query. When I run application I see only three columns even there are defined 4 columns in table descriptor and also same in select query. Is there some kind of limitation that GGC can't display two or more columns pointg to the same field?

Attachment: gridfilterproblem_12c50c6a.7z

Mohanraj Gunasekaran [Syncfusion]
Replied On August 17, 2017 08:51 AM UTC

Hi Josip,   
  
Thanks for using Syncfusion product.   
  
Query   
Solution   
How to format date while grouping by column? In normal view I have cell with datetime but when grouping data by that column i want to eliminate time display (see attachment)   
In order to set the format for Date column while grouping, you can use the Format property in GroupedColumns.Changing event. please refer to the below code example,   
   
Code example   
this.gridGroupingControl1.TableDescriptor.GroupedColumns.Changing+=GroupedColumns_Changing;   
   
private void GroupedColumns_Changing(object sender, Syncfusion.Collections.ListPropertyChangedEventArgs e)   
        {   
            if (e.Item is SortColumnDescriptor && (e.Item as SortColumnDescriptor).Name == "Date")   
            {   
                if (e.Action == Syncfusion.Collections.ListPropertyChangedType.Insert)   
                {   
                   this.gridGroupingControl1.TableDescriptor.Columns["Date"].Appearance.AnyRecordFieldCell.Format ="dd-mm-yyyy";   
                }   
                else if (e.Action == Syncfusion.Collections.ListPropertyChangedType.Remove)   
                {   
                   this.gridGroupingControl1.TableDescriptor.Columns["Date"].Appearance.AnyRecordFieldCell.Format ="";   
                }   
            }   
        }   
Note:    
If you want to customize the group caption text you can use the QueryCellStyleInfo event. please refer to the below KB link,   
   
   
 I have query that look like this:

SELECT field1, field2, field3, DATE_FORMAT(field3, '%d.%m.%Y') AS ColOnlyDate FROM myTable

In table descriptor there are 4 columns mapped according to fields in select query. When I run application I see only three columns even there are defined 4 columns in table descriptor and also same in select query. Is there some kind of limitation that GGC can't display two or more columns pointing to the same field?
   
No, you can bind more number of columns with GridGroupingControl. Columns are generated based on the bounded collection with GridGroupingCotnrol. Please let us know the below details,   
  
  • Please let us know whether you are using flat grid or nested grid.
  • Please ensure that your columns are available VisibleColumns collection or not.
  • If it is possible, please provide your sample or modify the below attached sample to reproduce your scenario.
  
The above details will be helpful to provide the solution at the earliest.   
  
Sample link: GridGroupingCotnrol   
   
Note:   
In your attached file, there is no details found based on your query which having a dynamic filter drop down screenshot alone.   
  
Regards,   
Mohanraj G   
 


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.

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

;