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.
please ignore this, I am taking a different approach