Is there a way to group rows in the grid?
Look at the attached picture and i want to group by 'Key Performance Indicators' and 'Returns on Funds Invested - Equity'
Hi,
Yes, you are looking for the OutlookGroupBy feature in the grid.
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { UltraGridLayout layout = e.Layout; UltraGridBand band = layout.Bands[0]; layout.ViewStyleBand = ViewStyleBand.OutlookGroupBy; band.SortedColumns.Add("Int32 1", false, true); // Optional. Only do this if you don't want the users to be able to change // the grouping layout.GroupByBox.Hidden = true; }
Is there anyway i can sort the groups. In the example below i enter the data in this order and this is the order i want it to sort on the grid
1. Introduction 2.Key Metrics 3. Revenues 4. Costs
This is how is does sort
Thanks for you help. I ended up using merge cells and it done what i wanted.
Yes, you can sort the groups in any order you like. How you do it depends on what behavior you want, though.
The easiest way to handle this would be to create a SortComparer and assign it to the Section column. A SortComparer is any class which implements IComparer. The x and y objects passed in to the Compare method will be UltraGridCell pbjects and you can check the Value or Text of the cells and sort them however you want.
This also means that the column will be sorted in this order regardless of whether it's grouped or not.
If you don't want this sorting to affect the column when it is not grouped, then you have to use the GroupByComparer property, instead.