How to Show the Month name (Es. Settembre) in CaptionSummaryRow

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.

Image_1726_1726241097179

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


5 Replies

MA Manikanda Akash Munisamy Syncfusion Team September 16, 2024 02:49 PM UTC

Hi Maurizio,

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



MA Maurizio replied to Manikanda Akash Munisamy September 16, 2024 03:12 PM UTC

Hi,

I've tested your sample and implemented your code in my projects and now all work fine how expected.


Thanks

Regards



MA Manikanda Akash Munisamy Syncfusion Team September 17, 2024 05:05 AM UTC

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



MA Maurizio March 21, 2025 04:52 PM UTC

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

Image_5980_1742575615548

How can I solve it?

Thanks in advance

Regards



RM Rabina Murugan Syncfusion Team March 24, 2025 06:51 AM UTC

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


Attachment: CustomSorting_bba0981c.zip

Loader.
Up arrow icon