I have a set of data where there may be 1, 2 or 3 parts of a primary piece of data. The user wants the 1,2 or 3 rows to be always grouped together, however they do not want a group by row (I've already shown them that). I've also tried an hierarchical grid and they don't want that either, because they need to look at the grid at a glance and see everything.
They want something like this:
A1A2A3B1B2C1D1D2
Now even when they click to sort any of the other columns of data, all the A's should stay together in a group.
I've been trying to figure this out for a while and I'm stumped!
Thanks in advance.
Hi, sigtaupres.
You should put away OutlookGroupBy option:
grid.DisplayLayout.ViewStyleBand = Infragistics.Win.UltraWinGrid.ViewStyleBand.OutlookGroupBy;
And use your own logic for grouping columns via creating a class and implement IGroupByEvaluator interface. This interface allows you to determine which rows belong in the same group and which don't. Then assign it to a column:
GroupEvaluator eval = new GroupEvaluator();grid.DisplayLayout.Bands[0].Columns["MyColumn"].GroupByEvaluator = eval;
In the next methods of GroupByEvaluator you can define your custom logic:
public object GetGroupByValue(UltraGridGroupByRow groupByRow, UltraGridRow row) { return null; // place your own logic } public bool DoesGroupContainRow(UltraGridGroupByRow groupByRow, UltraGridRow row) { return false; //place your own logic }
Note that the ICustomGroupByEvaluator will only get called to evaluate rows that are adjacent. So you may also need to implement a SortComparer on the column to make sure the column is sorted in the correct order before it is grouped.
Alex.
Alex,
So if this groups rows correctly, will they still have the standard "group by" header? With the blank line with some text that is typically the value that is grouped?
The users are very clear, they do NOT 't want any group by rows to display.
Thanks!
STP
Sigtaupres,
As I mentioned above, you need to set the ViewStyleBand property on the grid to something other than OutlookGroupBy.This will hide "group by" header. But this will also disable default grouping of records.
So you should group rows yourself via IGroupByEvaluator.