Hello,
I am using the ui.igGridGroupBy component to display summaries after the title and count of my rows in the grid within the context of grouped rows.
I have referred to this page: https://www.igniteui.com/grid/grouping to achieve this. However, I have noticed some issues, particularly with date column summaries. I use the "columnSettings summaries"
With all summaryFunctions, the date format appears to be transformed into a number, resulting in strange results. For example, the date "29/04/1997 02:00" (French date notation) is transformed into "29,041,997,020,000". This happens with all date formats, whether it's in English, French, or any other language.
If you would like to test, here is a fiddle based on the page I mentioned earlier: http://jsfiddle.net/7e6y0box/106/
How can I resolve this issue?
Thank you in advance for your response!
Hello Vincent,
Please let me know if you need any futher information regarding the suggested solution.
Thank you for using Infragistics components.
Regards, Monika Kirkova, Infragistics
Thank you for your response. However, I would prefer not to use a workaround for now. I will wait a little longer in the hope of a quick resolution to my problem. Nevertheless, if the fix doesn't arrive on time, I think I will try your workaround. If that happens, I will let you know if I managed to resolve the issue with your suggested solution.
Thank you, and I will keep you updated if there are any developments.
Thank you for following up!
I have been looking into your clarifications and what I could say is that you are correct that dates can have multiple formats depending on the language.
Having this in mind, in the previously attached sample I have set the custom summary to return the stored time value in milliseconds via the getTime function.
customSummary: function(data) { var minDate = new Date(Math.min.apply(null, data.array)); var time = minDate.getTime(); return time; }
Afterwards, inside the rowsRendered event handler I am using a regex in order to retrieve this value, however, this could be achieved in a different manner. Then, I am setting the desired date value that should be displayed to a string value which is appropriate to the host environment's current locale via the toLocaleDateString function.
var dateValue = new Date(parseInt(concated)).toLocaleDateString();
On my side, after testing the attached sample with different locale settings, what I could say is that the date value is displayed appropriately for the different languages. The same is true when using the toLocaleString function which was applied in the provided sample from the initial message.
Please test it on your side and let me know how it behaves.
Looking forward to your reply.
Sincerely, Riva Ivanova Associate Software Developer
I have looked into the solution you suggested. Using a regex does not suit me because dates can have multiple formats (including with time or different formats depending on the language).
I have analyzed what is actually happening, and it seems to be related to the grouping column. The format that will be in the summary is determined based on the grouping column, not the column for which we want to create the summary. So, if we group by a date column, the numeric columns will be transformed into dates, and vice versa. I invite you to take a look at this fiddle: http://jsfiddle.net/q8e3Lg5y/4/
I have opened a support ticket because I would like this bug to be resolved.
However, thank you for taking the time to respond to me.
Best regards
Thank you for posting in our community!
I have been looking into your question and after an investigation what I could say is that although the described behavior is reproducible it is also expected.
The reason for the summary value to be formatted from the following "29/04/1997 02:00" to the following "29,041,997,020,000" is because the summaries are a list of aggregation functions to calculate column values for each group and the summary result is expected to be of type number. This is also the reason for the summaryFormat option’s default value to be #.00 which shows two digits after the decimal place since the value is expected to be a number.
Having this in mind, in case you require to display date formatted values as summary values, I would suggest using an approach similar to the one demonstrated in the following forum post here.
Additionally, here could be found a small sample for your reference. Please test it on your side and let me know if you need any further assistance regarding this matter.