BoldSign®Effortlessly integrate e-signatures into your app with the BoldSign® API. Create a sandbox account!
Hi,
I've a SfDatagrid with a column containing a date formatted to show the month name as follow:
DBGridScadenze.Columns.Add(new GridDateTimeColumn() { MappingName = "MeseScad", HeaderText = "Mese", Format = "MMMM" });
The grid is populated with a observablecollection and when is loaded all work fine, but when I group the column Month, in the caption summary is displayed the date instead of the month name.
The capiton is formatted as below:
GridSummaryRow captionSumScadForn = new GridSummaryRow();
captionSumScadForn.Name = "CaptionSummary";
captionSumScadForn.ShowSummaryInRow = true;
captionSumScadForn.Title = "{ColumnName}: {Key} - Nr. {ItemsCount} Scadenze - Tot. Importo: {Importo}";
How can I format the caption to show the Month Name?
Thanks in advance
Regards
We have reviewed your scenario regarding the CaptionSummaryRow text format matching the GridDateTimeColumn values. This can be achieved by setting GroupMode = DataReflectionMode.Display for that particular column, which ensures that the view is based on the formatted display value. We have prepared and attached a sample for your reference.
Code Snippet:
sfDataGrid1.Columns.Add(new GridDateTimeColumn() { MappingName = "ShippingDate", Format ="MMMM", GroupMode=DataReflectionMode.Display });
Could you please review the sample and confirm if it aligns with your requirements?
If we have misunderstood any aspect of your needs, kindly provide additional details about the issues you're encountering. Your feedback will help us better understand the problem and provide an appropriate solution.
We look forward to your response.
Regards,
Manikanda Akash
Attachment: SfDataGrid_Demo_4_8_d24fd46.zip
Hi,
I've tested your sample and implemented your code in my projects and now all work fine how expected.
Thanks
Regards
Hi Maurizio,
You're welcome.
Please get back to us if you need any further assistance, we will be happy to
help you.
Regards,
Manikanda Akash
Hi,
sorry to reopen this old post, but I noticed a problem occurs when I group the data by month and I do a sort. As you can see from the photo below, when I do a grouping by month the sorting is done alphabetically and not by time date (January, February, March, April etc.)
How can I solve it?
Thanks in advance
Regards
Hi Maurizio,
We have investigated your reported scenario. Since the group mode is set to Display for grouping the column based on the month format instead of the actual DateTime value, the sorting is also performed based on the displayed text.
To address this, we have implemented a Custom Sort Comparer for accurate sorting of month values when the group mode is set to Display. This ensures proper sorting order for grouped data.
Kindly find the attached sample for detailed implementation and video for reference.
Please let us know if you need any further assistance.
Regards,
Rabina