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
1175
igGrid Summaries display as percent
posted

We are displaying a grid with some fake data in it and we want to show the summary column as a percentage with a precision of 2 decimals places.  We have the value showing up but how do I format the value to read:

-67.68%

Right now it omits the percent sign.  I've tried the "rowDisplayLabel" but that is more of a prefixing.  I tried different format values like "{0:P2}" but that didn't work either.

settings.ColumnSetting().ColumnKey("CompensationPercentageOver").AllowSummaries(true).SummaryOperands(x =>
 {
     x.SummaryOperand().Type(SummaryFunction.Custom).Active(true).Format("{0:2}").RowDisplayLabel("").SummaryCalculator("calculateCompensationPercentageOver");
 });

The column is setup as a normal column as a number.

For extra brownie points - is there any way to show specific values in a different color?  Like negative values should be red while positive values should be in black.  Thoughts?

Parents
  • 1175
    Offline posted

    I found the way.

    Change the format in the summary settings to .Format("percent") and then in the calculation, I divide the value by 100 to offset the inherit calculation by 100.

Reply Children