Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
75
Hide GroupBy Row
posted

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:

A1
A2
A3
B1
B2
C1
D1
D2

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.

Parents
  • 1590
    posted

    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.

Reply Children