The problem I am trying to solve is to display a list of entities in a UltraGrid that can/might be versioned. The dataset will have 1 or more rows per item name. What I would like to do is group by the item name and display a normal looking grid. IFF there is more than one item, then present the + expander to the left for that row. When the + expander is clicked, the other items would be displayed under the current version.
Is this possible with the UltraGrid? If so, how would I implement it?
scarleton
Hi Scarleton,
It sounds to me like you want to use OutlookGroupBy and group your rows by the ItemName. What you would do is something like this:
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { UltraGridLayout layout = e.Layout; UltraGridBand rootBand = layout.Bands[0]; UltraGridOverride ov = layout.Override; // Set the ViewStyleBand to allow grouping. e.Layout.ViewStyleBand = ViewStyleBand.OutlookGroupBy; // Group by the column e.Layout.Bands[0].SortedColumns.Add("Int32 1", false, true); // If you don't want the users to be able to change the grouping, you would hide the // GroupByBox e.Layout.GroupByBox.Hidden = true; }
The last line here about hiding the GroupByBox is optional.
Mike,We have the same requirement (grouping data by columns). I have an UltraWinGrid bound to a flat DataSet, with the ViewStyleBand on the layout set to 'OutlookGroupBy'. Then when I run the app I drag a column to the GroupBy box. We are trying to make each subsequent level appear as just another row in the grid (although indented and with the lines and expansion indicators). Additionally, each parent row is a summary of all the rows below it. Thus what we would end up with is something like a treetable.I am attaching a screen shot of what we are trying to get it to look like. I know what we are trying to do is possible because the screen shot is of an application that was built using Infragistics UltraWinGrid. So my question is, is the 'OutlookGroupBy' the way to achieve this? Or should we be looking at another method in the UltraWinGrid? I realize this inquiry is sort of nebulous but I've been hacking at this for several days now with no clear answer.
Thank you in advance!
It's a bit hard to say, since, as you say, the question is a bit nebulous.
A lot of how you do this depends on the needs of your application. Using OutlookGroupBy in a case like this has some big advantages. For one thing, since you have a flat set of data, OutlookGroupBy is really the only way to create a hierarchy in the grid.
On the other hand, this screen shot doesn't have any GroupByRows in it. So it doesn't sound to me like you really want grouping, you just want to create a hierarchy of data rows. If that's the case, then what you probably need to do is take your flat table and somehow create a hiearchical data source out of it. If this is a single DataTable, then this would be very easy. All you would have to do is create a DataSet with this table in it and then create a relationship from one column in the table to another so it creates a recursive data source. Of course, in order for that to work, each row needs some kind of ID field and another field that points to the parentID.
Mike,
Thanks for the quick reply. I'll try to simplify my question...
Each parent row DOES have some of the behavior of a GroupBy row in that its children are all grouped by a particular data column. Also, each of the cells (except first one) is an aggregate of all of its children. So I actually am trying to group rows in hierarchical fashion. But when I tried the OutlookGroupBy I was unable to make it look/act the same as what you see in the picture.1) Can you make the GroupBy row have row selector displayed? (see Image)2) How do you keep the GroupBy row and its first child together (no space between) so it appears they are 2 rows of the same grid (but the child is indented, of course)?
JavaOne said:1) Can you make the GroupBy row have row selector displayed? (see Image)
No, you cannot. GroupByRows are never editable - they have no cells. Clicking anywhere on the row selects the row. So there's really no point in having a separate RowSelector. You can have summary cells inside the GroupByRow so it sort've looks similar to a regular row, but it's really not.
JavaOne said:2) How do you keep the GroupBy row and its first child together (no space between) so it appears they are 2 rows of the same grid (but the child is indented, of course)?
I'm not sure what space you are referring to. There's no space between the GroupByRow and it's first child row by default. Unless by "space" you mean the column headers. What you probably want to do there is set the DisplayLayout.Override.HeaderPlacement to FixedOnTop.