Image 1 is the data I have to start with
Image 2 is how I need the data to be formatted.
Just pivoting this data is out of the question as it does not do what I need it to do.
I have tried to use band.Groups, but I can't get it to work and the example provided here http://help.infragistics.com/Help/NetAdvantage/NET/2008.3/CLR2.0/html/Infragistics2.Win.UltraWinGrid.v8.3~Infragistics.Win.UltraWinGrid.UltraGridGroup.html doesn't show me how to add multiple groups to a group
any help would be much appreciated
The WinGrid does not have any functionality to automatically pivot the data. The grid displays the data from the DataSource you give it. So in order to get a view like this, you would have to bind the grid to a DataSource which has the data in the structure you want.
Regarding the groups in the grid, you can't have nested groups using v8.3 of the grid. This was not supported in that version. Nested group functionality was added to v9.1 of the WinGrid along with the Groups in RowLayouts feature. The easiest way to set that up would be to use the grid designer and select "RowLayout with Groups" from the ColumnArrangement Overview section, and then you can create groups and arrange the columns in the designer.
I can't do this in the designer, it needs to be set programmatically, I upgraded to 9.1 and still can't get it working
I tried this code with no luck, no data is displayed under the groups
dt.Rows)
{
;
i=0; i<lstGroupingColumns.Items.Count;i++)
)lstGroupingColumns.Items[i];
try
+drow[li.ValueMember.ToString()].ToString(), drow[li.ValueMember.ToString()].ToString());
)
uggTemp.RowLayoutGroupInfo.ParentGroup = uggParent;
uggParent = uggTemp;
}
uggParent = band.Groups[i.ToString()+
+drow[li.ValueMember.ToString()].ToString()];
(i == lstGroupingColumns.Items.Count - 1)
j = 0; j < lstGroupingMeasures.Items.Count; j++)
)lstGroupingMeasures.Items[j];
Hi,
I'm afraid you have completely lost me. You didn't ask about reordering the columns. Your question was about adding columns to the right. I'm not entirely sure exactly what that means, but I guessed that you meant you wanted your columns aligned to the right-hand side of the grid.
What does "add columns to the right" mean?
You have total control over the order of the columns. You can position them in any order you like. If you are using RowLayouts, you would use the column.RowLayoutColumnInfo.OriginX and OriginY to position the column. If you are using the standard (non-RowLayout) mode, you would use the column.Header.VisiblePosition.
when you say "RowLayouts" what does that mean? if this is set?
ultraGrid.DisplayLayout.Bands[0].RowLayoutStyle = RowLayoutStyle.GroupLayout;
Yes, that's the style you need if you are using multiple levels of nested groups.
When using a RowLayout, the grid uses a concept called a GridBagLayout to arrange the columns and groups. I'm sure there are probably some good web resources out there that explain GridBagLayouts better than I could.
But essentially think of it as a sort've virtual grid of logical rows and columns. Each column in the grid, and each group, has a position and a span as defined by the column.RowLayoutColumnInfo or group.RowLayoutGroupInfo. There are properties for OriginX and OriginY and SpanX and SpanY. And also ParentGroup so you can create a hierarchy.
OK I set
Column1.OriginX=0 and Column1.OriginY=0
then I set
Column2.OriginX=1 and Column2.OriginY=0
the bottom grid is what I get and the top grid is what I'm looking for, in the bottom grid, the class column is actually behind the line column
if anyone can see how to change the code a few posts above from Mon, Jul 27 2009 3:57 PM to make the grid look like the first one, I'd really appreciate it
The default SpanX and SpanY of a column are 2x2. So to avoid overlapping, you either need to set:
Column2.OriginX=2
or
Column1.SpanX=1