Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
4032
Summary minutes and display as hour:minutes
posted

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

Parents
  • 7555
    Offline posted

    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

Reply Children