Hello!
I have attached a file showing the result that I am looking for..
I have two different tables, on eparent (Elements) and one child (Products).
I first create one dataset and then i put and the parent table, then the child table and last of all I create the relation between them. The I add this dataset to the DataSource property of the UltraGrid and do the Binding. The result will be according to the picture on the left side.
I have added some summary code giving me tha original summary appearance in the second Band according to the appearance when it is loaded.
Me.ug.DisplayLayout.Override.AllowRowSummaries = Infragistics.Win.UltraWinGrid.AllowRowSummaries.False Me.ug.DisplayLayout.Override.SummaryDisplayArea = Infragistics.Win.UltraWinGrid.SummaryDisplayAreas.Bottom Me.ug.DisplayLayout.Override.SummaryFooterCaptionVisible = Infragistics.Win.DefaultableBoolean.False
Me.ug.DisplayLayout.Bands(1).Summaries.Add("WeightTotal", Infragistics.Win.UltraWinGrid.SummaryType.Sum, Me.ug.DisplayLayout.Bands(1).Columns("WeightTotal"), Infragistics.Win.UltraWinGrid.SummaryPosition.UseSummaryPositionColumn) Me.ug.DisplayLayout.Bands(1).Summaries.Item(1).DisplayFormat = "{0:" & WeightFormat & Chr(32) & "}" Me.ug.DisplayLayout.Bands(1).Summaries.Item(1).Appearance.TextHAlign = Infragistics.Win.HAlign.Right
When I later use the groupby option, and dragging the column ModuleID to the groupby area, I would like to have the weighttotal for all the elements in that Module to be summarized according to the position in the image on the right hand side...
Can this behavior be achived?
Thanks for the help!
/Henrik
Is there any way to achieve this functionality with the UltraWebGrid?
Yes, you are right about the fact that grouping by ElementID doesn't make a lot of noise in this example. But let us group by ModuleID instead... You are also right about your conclusion in the bottom, regarding what I want to achive.I want to summarize if there are two parent rows of the same ID.
I will try my luck to add an unbound column to the parent band and populate it using the InitializeRow Event. Thanks for the smashing answer...
Okay. If you group by ElementID, or any field in the first band, then only the summaries for that first band will display in the GroupByRow.
So it sounds like what you want to do is here is add a summary to Band 0 which displays some information about the child rows.
This is a little bit odd and there's no really simple way to do it.
My first question would be - why group on the ElementId? It appears that this is a unique field in the column - at least in this sample. So grouping by this field creates groups with a single row in each one. It's really no different than the ungrouped view. So why bother?
If the real data will have rows with duplicate ElementIDs, then it makes more sense to group by this field. But then the summary in the GroupByRow becomes a little puzzling. Right now, you could add an unbound column to Band 0 and populate it with the summary of the child bands. But when there are two parent rows with the same ElementID, I imagine you would want the total of all children of both parent rows. Is that right?
If that's what you want, then I would add an unbound column or two to the parent band. Use the InitializeRow event to populate this column with the value of the summary in the child rows for each parent.
Then you could add a summary to the root band which calculates a sum of this unbound column. Then this summary would show up in the GroupByRows.
Yes, I did... ;-)Perhaps this solution helps...
Hi Henrik,
It looks like you just incuded a form file here with no solution, so I am not able to run it. You need to include the whole project with the proj and solution files, as these contain important information like the project references and indicate which version of Visual Studio to use.