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

Grid Grouping format date while grouping by

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

1 Reply

MG Mohanraj Gunasekaran Syncfusion Team 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   
 


Loader.
Up arrow icon