Hello,
I want to use GroupByRows in my ultrawingrid. The structure of the table that Im using is diplayed in the image that I attached.
So, I need that my group by rows show me the total of meters for each zone and for each subzone too, exaxcly as shown in the picture.
what can I do?
Any suggestions, I'll be very grateful
Help me please.
Sorry Mike, I sending you this new image, I hope you understand me now
Ok Mike, sorry for this againI´m trying to explain myself as well as I canWe should forget all of the above and start again...ok, I have my ultragrid in groupbyrows (my table have 3 columns, Zone, Subzone and mts),like this: +zone +subzone mts so, in the beginning, i didn't know how to change the description text for each groupbyrow, for that, I used InitializeGroupByRow and I changed for a custom text the description of each groupbyrowsusing e.Row.Description="My custom text"everything it's ok here (IMAGE 1 AND 2)But I need the sum of the column "mts" and put it in the groupbyrows ((IMAGE 3)In this part is where i'm having problems, because in the groupbyrows the result Of The Sums is displayed with along the source column (mts): some like this: "mts sum=[resultOfTheSum]"To change sum=[resultOfTheSum] for a custom text (IMAGE 4) , I used:summary.DisplayFormat = "Total of meters = {0}"but, mts is still diplaying with along my custom text "Total of meters = {0}". (IMAGE 4)**************************************************************************************************************************************************************************************************************My code**************************************************************************************************************************************************************************************************************Imports Infragistics.WinPublic Class SummaryGroupByRow Private Sub SummaryGroupByRow_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' Note. In this part, I will use data from a database,
' but there's so much information, for that reason I use the code below to populate my ultragrid
' to simplify my real proyect UltraDataSource1.Band.Columns.Add("zone", GetType(String)) UltraDataSource1.Band.Columns.Add("Subzone", GetType(String)) UltraDataSource1.Band.Columns.Add("mts", GetType(Integer)) UltraDataSource1.Rows.Add(New Object() {"A", "101", 200}) UltraDataSource1.Rows.Add(New Object() {"A", "101", 200}) UltraDataSource1.Rows.Add(New Object() {"A", "102", 200}) UltraDataSource1.Rows.Add(New Object() {"A", "102", 200}) UltraDataSource1.Rows.Add(New Object() {"B", "103", 200}) UltraDataSource1.Rows.Add(New Object() {"B", "103", 200}) UltraDataSource1.Rows.Add(New Object() {"B", "104", 200}) UltraDataSource1.Rows.Add(New Object() {"B", "104", 200}) UltraDataSource1.Rows.Add(New Object() {"B", "104", 200}) Me.UltraGrid1.DataSource = Me.UltraDataSource1 UltraGrid1.DisplayLayout.Bands(0).SortedColumns.Add("zone", False, True) UltraGrid1.DisplayLayout.Bands(0).SortedColumns.Add("Subzone", False, True) End Sub Private Sub UltraGrid1_InitializeGroupByRow(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeGroupByRowEventArgs) Handles UltraGrid1.InitializeGroupByRow ' Without this code and InitializeLayout code (except AutoFitStyle),
' Ultragrid has an appearence as shown in the image 1 ' Using the code below, Ultragrid has an appearence as shown in the image 2 If e.Row.Column.Key = "zone" Then
e.Row.Description = "Zone : " & e.Row.Value.ToString() & ", Total of Subzones : " & e.Row.Rows.Count e.Row.Appearance.BackColor = Color.Purple e.Row.Appearance.ForeColor = Color.Yellow e.Row.Appearance.FontData.Bold = DefaultableBoolean.True End If If e.Row.Column.Key = "Subzone" Then e.Row.Description = "Subzone : " & e.Row.Value.ToString() & ", Total of rows : " & e.Row.Rows.Count e.Row.Appearance.BackColor = Color.Tomato e.Row.Appearance.ForeColor = Color.Black e.Row.Appearance.FontData.Bold = DefaultableBoolean.True End If End Sub Private Sub UltraGrid1_InitializeLayout(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles UltraGrid1.InitializeLayout UltraGrid1.DisplayLayout.AutoFitStyle = AutoFitStyle.ExtendLastColumn ' Before to add this code and after have added InitializeGroupByRow code ,
' Ultragrid has an appearence as shown in the image 1-2 ' After I add the code below, Ultragrid has an appearence as shown in the image 3 ' Default summary caption is displayed ' for exmaple "mts sum=[theSum]" where mts is the source column summarized Dim columnToSummarize As UltraGridColumn = e.Layout.Bands(0).Columns("mts") Dim summary As SummarySettings = e.Layout.Bands(0).Summaries.Add(SummaryType.Sum, columnToSummarize) e.Layout.Override.SummaryDisplayArea = Infragistics.Win.UltraWinGrid.SummaryDisplayAreas.InGroupByRows 'If I use DisplayFormat , it changes "mts sum=[theSum]" to "mts Total of meter = [theSum]" 'but I don't want "mts" in the summary caption (image 5) 'summary.DisplayFormat = "Total of meters = {0}"
' I dont Know for what reason "mts" is displayed End SubEnd ClassWhat can I do to remove "mts"?What could be happening?
Hi,
Okay, I see the problem, now. I'm not sure why the column name is still in there. This might be a bug.
I'm going to forward this thread over to Infragistics Developer Support so they can write this up and have it checked out.
In the mean time, what you can do is set SummaryDisplayArea to None. Then, in the InitializeGroupByRow, you can get the summaries and add them to the Description with whatever text you like. To get the summary from the GroupByRow, you use the e.Row.Rows.SummaryValues collection.
Ahhh, ok,
Where can I find some information about how to use e.Row.Rows.SummaryValues?
Do you have a little example for this?
Thanks Mike
I'm sure SummaryValues are documented in the help. The SummaryValue is essentially a specific instance of a Summary for a particular collection of rows. It has properties like Value, which returns the actual calculated summary value and an Appearance, so you can set the appearance of the summary and make it look different from other instances of the same summary, if you want.
Thank you so much
It's working properly now
Thank you for everything !!!!
Regards.....