[!Note] Please note that this control has been deprecated and replaced with the Grid component, and as such, we recommend migrating to that control. This will not be receiving any new features, bug fixes will be deprioritized. For help or questions on migrating your codebase to the Data Grid, please contact support.

    Web Components 행 그룹화

    Ignite UI for Web Components Data Table/Data Grid를 사용하면 행을 'sticky header' 행 그룹으로 그룹화할 수 있습니다. 이는 Microsoft Outlook의 Group By 기능과 유사하며, 이는 사용자의 기준에 따라 데이터를 시각적으로 그룹화하는 쉬운 방법입니다.

    Web Components Row Group-By Area Example

    Group-By Area

    Set isGroupByAreaVisible property on the DataGrid to True, as shown in the example above, to the user interface. The group-by area allows users more options to group and sort columns without interact when interacting the DataGrid indirectly. Groups can be positioned and reordered based on the users needs. This area also populates when columns are programmatically added as groupDescriptions on the DataGrid as well.

    Using Group Descriptions Example

    Hierarchical Groups

    The groupHeaderDisplayMode property allows the groups to be hierarchical. By default, each group description that is added gets aggregated together. Setting the groupHeaderDisplayMode to Split will create a section header for ever group defined in groupDescriptions property of the IgcDataGridComponent.

    import { GroupHeaderDisplayMode } from 'igniteui-webcomponents-core';
    
    public connectedCallback() {
        // ...
        this.grid.groupHeaderDisplayMode = GroupHeaderDisplayMode.Split;
    }
    

    Collapsible Groups

    Also, the IgcDataGridComponent can display a toggle on each group section to allow the end user to expand or collapse the grouped data via the isGroupCollapsable property.

    public connectedCallback() {
        // ...
        this.grid.isGroupCollapsable = true;
    }
    

    Summary

    귀하의 편의를 위해 위의 모든 코드 조각은 아래의 하나의 코드 블록으로 결합되어 프로젝트에 쉽게 복사할 수 있습니다.

    import { IgcIgcColumnGroupDescription } from 'igniteui-webcomponents-data-grids';
    import { ListSortDirection } from 'igniteui-webcomponents-core';
    import { GroupHeaderDisplayMode } from 'igniteui-webcomponents-core';
    
    public connectedCallback() {
        const state = new IgcColumnGroupDescription();
        state.field = "Country";
        state.displayName = "Location";
        state.sortDirection = ListSortDirection.Descending;
        const city = new IgcColumnGroupDescription();
        city.field = "City";
        city.displayName = "";
        const income = new IgcColumnGroupDescription();
        income.field = "Income";
        income.displayName = "Income";
    
        this.grid = document.getElementById("grid") as IgcDataGridComponent;
        this.grid.groupDescriptions.add(state);
        this.grid.groupDescriptions.add(city);
        this.grid.groupDescriptions.add(income);
    
        this.grid.isGroupCollapsable = true;
        this.grid.groupHeaderDisplayMode = GroupHeaderDisplayMode.Split;
    }
    

    API References