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,
KB link: https://www.syncfusion.com/kb/5194/how-to-customize-the-group-caption-text-in-gridgroupingcontrol
|
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,
The above details will be helpful to provide the solution at the earliest. |