I have a grid with multiple bands.
One of the bands has more than 10 rows but I can sum them in order to just have 2 rows (because the 10 rows or more are just of 2 types TAX or OTHER:
Type Col Desc Column Amoun Column
TAX SERVICE TAX $80TAX SERVICE TAX $91TAX SERVICE TAX $102.....OTHER OTHER ITEM -$37OTHER OTHER ITEM $85....
So I want to have just 2 rows but with the corresponding sum of the amount column.
How can I do that in a specific band of the grid? I just want to have:
TAX SERVICE TAX $sum of taxesOTHER OTHER ITEM $sum of others
Hope someone can help me!!
Thanks,
Alejandro
Hi Alejandro,
I think you could acheive what you want using the OutlookGroupBy feature of the grid. You would simply group the grid by the "Type Col" column and this would create a sort've artificial hierarchy with two rows at the root level and then each parent row would have the "real" data rows as it's child rows.
To do this in code, you would do something like this:
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { UltraGridLayout layout = e.Layout; // Enabled OutlookGroupBy layout.ViewStyleBand = ViewStyleBand.OutlookGroupBy; // Hide the GroupByBox so the user cannot change the groupings. layout.GroupByBox.Hidden = false; // Group by the Type Col column. layout.Bands[0].SortedColumns.Add("Type Col", false, true); }
Thanks Mike but that works for the hole grid, I just want to make the Outlookgroupby just in 1 of the bands, the other i want to keep it they way they are.
Appreciate your support and hope you can guide me.
I'm not sure I understand what you mean. It sounds like maybe you want to hide the real data rows and just show the GroupByRow for Band 0 so that the child rows are directly under the GroupByRows.
But there is no way to do that - at least not in the grid. To do that, you would have to bind the grid to a DataSource that has the data in the structure you want.
Hello Mike,
Here is a sample of my actual grid: (in red is the band that I want to group)
and here is the image of the grid that I want to have:
So if you see I have in the first image 5 rows of the same type "TAX" and what I want to show is just one row because is the same type "TAX" but in the column "Importe" (amount in english) is the sum of all the row amounts.
Hope this will clear my question.
Thanks for the support and wish you can help me to achieve this result.
There's no functionality in the WinGrid to allow you to do this. You would have to modify your data source to have a single row in place of the 5 real rows and bind that to the grid.