Web Components Grid Multi-row Layout

    The Multi-row Layout in the Ignite UI for Web Components extends the rendering capabilities of the Web Components Grid. The feature allows splitting a single data record into multiple visible rows.

    Web Components Multi-row Layout Example

    The declaration of Multi-row Layout is achieved through IgcColumnLayoutComponent component. Each IgcColumnLayoutComponent component should be considered as a block, containing one or multiple IgcColumnComponent components. Some of the grid features work on block level (those are listed in the "Feature Integration" section below). For example the virtualization will use the block to determine the virtual chunks, so for better performance split the columns into more columnLayout blocks if the layout allows it. There should be no columns outside of those blocks and no usage of columnGroup when configuring a multi-row layout. Multi-row Layout is implemented on top of the grid layout specification and should conform to its requirements.

    The IgcColumnComponent component exposes four IgcInputComponent properties to determine the location and span of each cell:

    • ColStart - column index from which the field is starting. This property is mandatory.
    • RowStart - row index from which the field is starting. This property is mandatory.
    • ColEnd - column index where the current field should end. The amount of columns between colStart and colEnd will determine the amount of spanning columns to that field. This property is optional. If not set defaults to colStart + 1.
    • RowEnd - row index where the current field should end. The amount of rows between rowStart and rowEnd will determine the amount of spanning rows to that field. This property is optional. If not set defaults to rowStart + 1.
    <igc-column-layout>
    	<igc-column row-start="1" col-start="1" row-end="3" field="ID"></igc-column>
    </igc-column-layout>
    <igc-column-layout>
    	<igc-column row-start="1" col-start="1" col-end="3" field="CompanyName"></igc-column>
    	<igc-column row-start="2" col-start="1" col-end="2" field="ContactName"></igc-column>
    	<igc-column row-start="2" col-start="2" col-end="3" field="ContactTitle"></igc-column>
    </igc-column-layout>
    <igc-column-layout>
    	<igc-column row-start="1" col-start="1" col-end="3" field="Country"></igc-column>
    	<igc-column row-start="1" col-start="3" col-end="5" field="Region"></igc-column>
    	<igc-column row-start="1" col-start="5" col-end="7" field="PostalCode"></igc-column>
    	<igc-column row-start="2" col-start="1" col-end="4" field="City"></igc-column>
    	<igc-column row-start="2" col-start="4" col-end="7" field="Address"></igc-column>
    </igc-column-layout>
    <igc-column-layout>
        <igc-column row-start="1" col-start="1" field="Phone"></igc-column>
        <igc-column row-start="2" col-start="1" field="Fax"></igc-column>
    </igc-column-layout>
    

    The result of the above configuration can be seen on the screenshot below:

    [!Note] RowStart and ColStart properties must be set for each IgcColumnComponent into a columnLayout. The columnLayout component is not verifying if the layout is correct and not throwing errors or warnings about that. The developers must make sure that the declaration of their layout is correct and complete, otherwise they may end up in broken layout with misalignments, overlaps and browser inconsistencies.

    Feature Integration

    Due to the completly different rendering approach of Multi-row Layout, some of the column features will work only on columnLayout component. Such features are Column Pinning and Column Hiding. Othes like - Sorting and Grouping will work in the same way - on the IgcColumnComponent component.

    • Filtering - only Excel Style Filtering is supported. Setting FilterMode explicitly to FilterMode.quickFilter has no effect.
    • Paging - works on records, not visual rows.
    • Group By - HideGroupedColumns option has no effect in Multi-row Layout. The grouped columns are always visible.

    The following features are currently not supported:

    • Column Moving
    • Multi-column Headers
    • Export to Excel
    • Summaries

    Keyboard Navigation

    IgcGridComponent with Multi-Row Layouts provides build-in keyboard navigation.

    Horizontal Navigation

    • or - move to the adjacent cell on the left/right within the current row unaffected by the column layouts that are defined. If the current cell spans on more than one row, and should navigate to the first cell on the left and right with the same rowStart, unless you have navigated to some other adjacent cell before. The navigation stores the starting navigation cell and navigates to the cells with the same rowStart if possible.
    • Ctrl + (HOME) or Ctrl + (END) - navigate to the start or end of the row and select the cell with accordance to the starting navigation cell.

    Vertical Navigation

    • or - move to the cell above/below in relation to a starting position and is unaffected by the rows. If the current cell spans on more than one column the next active cell will be selected with accordance to the starting navigation cell.
    • Ctrl + or Ctrl + Down - Navigate and apply focus on the same column on the first or on the last row.
    • Ctrl + Home or Ctrl + End - Navigate to the first row and focus first cell or navigate to the last row and focus the last cell.

    [!Note] Navigation through cells which span on multiple rows or columns is done with accordance to the starting navigation cell and will allow returning to the starting cell using the key for the opposite direction. The same approach is used when navigating through group rows.

    [!Note] Selection and multi cell selection are working on layout, meaning that when a cell is active, its layout will be selected. Also all features of multiple selection like drag selection are applicable and will work per layout not per cell.

    Custom Keyboard Navigation

    The grid allows customizing the default navigation behavior when a certain key is pressed. Actions like going to the next cell or cell below could be handled easily with the powerful keyboard navigation API:

    • GridKeydown is exposed. The event will emit IGridKeydownEventArgs. This event is available only through the keyboard key combinations mentioned above, for all other key actions you can use KeyDown event.
    • NavigateTo - this method allows you to navigate to a position based on provided RowIndex and VisibleColumnIndex

    The demo below adds additional navigation down/up via the Enter and Shift + Enter keys, similar to the behavior observed in Excel.

    Demo

    Styling

    In addition to the predefined themes, the grid could be further customized by setting some of the available CSS properties. In case you would like to change some of the colors, you need to set a class for the grid first:

    <igc-grid class="grid"></igc-grid>
    

    Then set the related CSS properties to this class:

    .grid {
        --ig-grid-cell-active-border-color: #ffcd0f;
        --ig-grid-cell-selected-background: #6f6f6f;
        --ig-grid-row-hover-background: #fde069;
        --ig-grid-row-selected-background: #8d8d8d;
        --ig-grid-header-background: #494949;
        --ig-grid-header-text-color: #fff;
    }
    

    Demo

    API References

    Additional Resources

    Our community is active and always welcoming to new ideas.