I have UltraDataSource with columns of type integer of minutes value.
My grid summarizes this values as expected, but always displayed as minutes. For grid cells i'm using my datafilter class to display the cell value in hh:mm format. This workd fine, even if my grid is grouped by.
To avoid implementing and maintaining custom summaries (I have read other posts about that), I like to use my datafilter for the summaries as well.
Is that possible?
If not what is the easiest way to achieve displaying minutes as hh:mm in group-by grid?
Thanks
Markus
Hello,
Thank you for posting to our forum.
To display the hour:minutes in the summary you could do something like this:
var layout = e.Layout; var ov = layout.Override; var band = layout.Bands[0];
var minutesColumn = band.Columns["Minutes"]; minutesColumn.Format = "hh:mm"; minutesColumn.FormatInfo = new MinuteFormatter();
var minutesSummarySettings = band.Summaries.Add(SummaryType.Sum, minutesColumn); minutesSummarySettings.DisplayFormat = "{0:hh:mm}"; minutesSummarySettings.DisplayFormatProvider = new MinuteFormatter();
I have also attached the sample project i have created .
Please let me know if you need further assistance.
WinGrid_MinuteFormatter.zip
Hello, thank you for your sample. I could apply the ICustomFormatter to my project and it works generally: Summary was formatted hh:mm but normal grid cells not but if I still use my data filter all values looking good now exept I like to have always 2 chars for minutes: 8:0 -> 8:00 and suppress 0:00. I can make a change in the formatter class.
What I could not achieve is to set a caption to the summary row (see picture attached).
My grid is grouped by department-name and shows employees with some account-values.
sumSettings.SummaryPosition = SummaryPosition.UseSummaryPositionColumn;sumSettings.SummaryDisplayArea = SummaryDisplayAreas.GroupByRowsFooter | SummaryDisplayAreas.Bottom;
How I can set a caption like 'TOTAL' to the free area left of the summary values?
How I can set bold font only to the 'grand total' at the bottom?
Thank you for your help.
Thank you for the update.
I looked into our document and did some research and found that we really have no way to put a caption in a summary row - at least we have no support for that build-in to the grid.
So as a workaround there are a couple of approaches you could take. One is, you could put a summary on the first column and set it as SummaryType.External and then just set the value to whatever text you wants. That's the easiest way, but the down side is that the column would have to be wide enough to show the text. For that you can autosize the column, you can make it take the summary into account, so it might just waste some space in the cells if they are bigger than they need to be. Another approach would be to use a CreationFilter. This would be a pretty simple one. But both of these approaches are a little tricky because what if the user rearranges the columns so that the first column has a summary? So this only makes sense if the user can't move the columns around.
You need to set the Appearance on the appropriate SummaryValue. The SummarySetting is how you defined the summary for the entire band. But each instance of the summary is represented by a SummryValue object.
So... assuming that the header rows you have here are GroupByRows, you would need to get the SummaryValue for the root-level rows in this grid as that would be the one that represents the grand total.
So you would just do something like this:
this.ultraGrid1.Rows.SummaryValues["My Summary"].Appearance.FontData.Bold = DefaultableBoolean.True;
"My Summary" here is the Key you assigned to the SummarySettings when you created that summary in the first place. You may not have given it a key, but you should do that if you want to reference it later.
thank you for the workaround. Users are not able to rearrange columns, therefore I could apply this solution.
But as mentioned in the last post how I can set grand total label AND values to bold font, while keeping the group by values (department sum) in standard font?
How setting different appearance to different display areas?
See attached pic showing only the grand total label as bold.
Thank you and best wishes