How can “Group by” in an ultra-wide column?

The "Drag column heading to gorup by this column" function appears on the control. Can I do this programmatically. Are there any properties or do I need to include SQL statements?

Thanks sun

+3
source share
3 answers

You need to add a column to the SortedColumns collection in the group:

    private void SwitchGroupByFor(string key) //key stands for the ultragridcolumn key
    {
        var band = grid.DisplayLayout.Bands[0];
        var sortedColumns = band.SortedColumns;

        sortedColumns.Add(key, false, true); //last flag indicates is a group by column
    }

Hth

+11
source

Take a look here: http://forums.infragistics.com/forums/p/2418/15231.aspx#15231 and here: http://forums.infragistics.com/forums/t/5928.aspx

These lines are the ones that do the magic: grid1.DisplayLayout.ViewType = ViewType.OutlookGroupBy; grid1.Rows.Band.Columns[0].IsGroupByColumn = true; grid1.Rows.Band.Expandable = Expandable.Yes;

0
source

Just thought that I should also note that if you want to clear a group, here's how to do it: myGrid.Rows.Band.SortedColumns.Clear ()

0
source

All Articles