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
2745
UltraGrid - Positions and values for summaries
posted

Hello!

I have and ultragrid filled with data that can be shown in three different ways.

 

1. Not grouped at all, just rows straight from the source.

2. One level of grouped data.

3. Two levels of grouped data.

 

In the initializelayout event of the grid, I have included code to add the summaries to the grid.

I have used

 

SummaryDisplayArea =

SummaryDisplayAreas.BottomFixed + SummaryDisplayAreas.GroupByRowsFooter

 

First of all, how can I get the values of the different summary cells? I will need to get these values, no matter how the data is grouped.

 Secondly, is there a way to get some sort of label in front of each summary cell? I tried to se the 

SummaryFooterCaptionVisible to true but I could only get the label above the summary cell. I would like to have i just to the left of the summary cell.

 

All other ideas that could help me get this grid look even better are more than welcome...

Thanks!

/Henrik

 

 

Parents
  • 469350
    Verified Answer
    Offline posted

    Hi Henrik,

    Zlatan said:
    First of all, how can I get the values of the different summary cells? I will need to get these values, no matter how the data is grouped.

    The summary value can be retrieved from the rows collection. Something like this:

    grid.Rows.SummaryValues["my summary"].Value

    This will work in a flat grid, because the summary is on the root rows collection. It will also work in a grouped grid. The grid maintains the root-level grand total summaries, even though you are not displaying them - at least it did in my testing using the built-in summary types. I didn't try it using formulas, so that might be different.

    If you want the summary value of a set of child rows under a grouping, then you would have to get the rows in that group and access it's SummaryValues collection. So that means casting the root-level row (or possibly the first two levels, depending on how many levels of grouping you have) to an UltraGridGroupByRow. Then you can get the Rows collection of that group by row and using the SummaryValues collection just as above.

    Zlatan said:
    SummaryFooterCaptionVisible to true but I could only get the label above the summary cell. I would like to have i just to the left of the summary cell.

    There's no way to put in a label cell or something like that. But you can use the SummaryValue.DisplayFormat to preface the summary value with some text. The default is something like "Sum = {0}". But you can change this to whatever you want and use "{0}" as the replacement code for the value.

Reply Children