I have a grid with A, B, and C columns on it and a summary item at the bottom of the last two columns. Right now all the values are being added up but what I want is to have the first bound column (boolean) determine if the B and C columns are to be included in the summation or not. Any tip on how to implement this the most efficient way? Sample snippet will be appreciated.
Olivier Paquette said:On the other hand, if I choose your option of using unbound columns, could you tell me how to position the summary under another column than the one calculated?
When you create the summary, the Summaries.Add method has overload that take a SummaryPosiitonColumn and also a calculation column. So you just specify both.
You can also set the PositionColumn in the SummarySettings after you add it.
Hi,
If I choose the option of implementing the interface, do I have to create a class for every grid that I need to rework the summary, or can I use custom methods in the interface and add parameters like column names and ultragrid? This is beauce I will want to do different calculations depending of the grid and the columns.
On the other hand, if I choose your option of using unbound columns, could you tell me how to position the summary under another column than the one calculated?
Thanks a lot.
Another option would be to add an unbound column (let's call it D) to the grid and hide it. You would then use the InitializeRow event of the grid to examine the value of of the other cells in the row and populate column D with a value (which might be 0 if column A if false). Then you could add a summary for Column D and position it under Column B, or C.
UltraGrid supports customized summaries by way of the ICustomSummaryCalculator interface. The way it works is, you implement this interface on a class, then use the overload of the Summaries collection's Add method that takes a value of that type to add the summary. Methods will then get called on that class when the grid compiles the summary, and you can control what values get added in.