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
2005
Column grouping
posted

Hey,

I am using UltraWinGrid and would like to use column grouping as shown in the attached image. The features that I must have are:

  • Sorting
  • Filtering
  • Fixed individual columns or groups
  • Moving individual columns and groups

I also need to use a creation filter to get HeaderUIElement objects from its parent BandHeadersUIElement. I may need to replace HeaderUIElement objects by my own HeaderUIElement (derived classes from HeaderUIElement).

Your help is greatly appreciated!

Best Regards,
Shaolin

Parents
  • 1980
    Offline posted

    Hello Shaolin,


    In order to group the grid's columns the way you want, first you have to create the groups “Group 1”, etc. and add them to the band’s GroupsCollection. Then, you set the band's RowLayoutStyle to GroupLayout and the group column as parent to the subcolumns: "Grp1 Col1" and "Grp1 Col2"

    UltraGridBand band = e.Layout.Bands[0];

    band.RowLayoutStyle = RowLayoutStyle.GroupLayout;

    UltraGridGroup firstGroup = band.Groups.Add("FirstGroup", "Group1");

    band.Columns["Grp1 Col1"].RowLayoutColumnInfo.ParentGroup = firstGroup;
    band.Columns["Grp1 Col2"].RowLayoutColumnInfo.ParentGroup = firstGroup; 

    As by default the grid will place grouped columns before non-grouped columns, you have to arrange the columns and groups in the order you want by using the OriginX property on the RowLayoutColumnInfo or RowLayoutGroupInfo.


    To make "Column 1", “Column 2”, etc. span vertically, you would need to set their SpanY property to 2 (one for the group header and one for the column headers within the groups).


    The following forum thread regarding grouped column arrangement might help https://ko.infragistics.com/community/forums/t/60282.aspx


    You can enable all of the listed functionalities either in the grid’s designer by clicking the Start button and selecting the Feature Picker from the left-pane tab or in code.


    Sorting is under the ‘Header Sort Click Action’ and you can allow the user to sort on both single and multiple columns by clicking on the column headers. In code, you have to set the HeaderClickAction property:


    e.Layout.Override.HeaderClickAction = HeaderClickAction.SortSingle;


    You can enable filtering by expanding the ‘Filtering’ node and then selecting the Allow option or in code:


    e.Layout.Override.AllowRowFiltering =  DefaultableBoolean.True;


    You can enable fixed columns either in designer under the ‘Fixed Headers’ node or by setting the Fixed property on column headers and/or group headers. You can find a sample on the fixed header functionality on the following link:
    http://help.infragistics.com/Help/Doc/WinForms/2011.2/CLR2.0/html/Infragistics2.Win.UltraWinGrid.v11.2~Infragistics.Win.UltraWinGrid.HeaderBase~Fixed.html


    The grid has built-in functionality for allowing the user to move and swap columns. By default, column moving is enabled in non-Row Layout mode. In Row Layout mode you must explicitly enable column moving by setting the AllowColMoving to WithinBand.

    Column swapping is not enabled by default. To enable it, you must set the AllowColSwapping to WithinBand.

    Column groups can be moved and swapped in exactly the same manner as columns. You must set the AllowGroupMoving and AllowGroupSwapping properties as appropriate.


    You can find more information on the UltraGrid on https://ko.infragistics.com/help/winforms/wingrid. The ‘Using WinGrid’ section provides information and examples on all the main built-in grid’s functionalities.


    You can find more information about Creation Filter on https://ko.infragistics.com/help/winforms/win-creation-filter. I also recommend using the Infragistics UIElementViewer Utility in this case because it will allow you to move your mouse over the grid and see its UIElements.


    Please let me know if you need further assistance regarding this matter.

Reply Children