Row spanning in TypeScript Grid control
18 Nov 20182 minutes to read
The grid provides an option to span row cells, allowing you to merge two or more cells in a row into a single cell. This feature can be useful in scenarios where you want to display information that spans across multiple rows, but want to avoid repeating the same information in each row.
To achieve this, You need to define the rowSpan attribute to span cells in the queryCellInfo event. The rowSpan attribute is used to specify the number of rows that the current cell should span.
The queryCellInfo event is triggered for each cell in the grid, and allows you to customize the cells in the grid. By handling this event, you can set the rowSpan attribute for a cell to achieve row spanning.
In the following demo, Davolio cell is spanned to two rows in the EmployeeName column.Also Grid supports the spanning of rows and columns for same cells. Lunch Break cell is spanned to two rows and three columns in the 1:00 column.
To disable the spanning for particular grid page, you need to use requestType from
queryCellInfoevent argument.
TherowSpanandcolSpanattributes can be used together to merge cells both vertically and horizontally.
Limitations
- The updateCell method does not support row spanning.
- Row spanning is not compatible with the following features:
- Virtual scrolling
- Infinite scrolling
- Grouping
- Row drag and drop
- Autofill
- Inline editing
- Batch editing
- CRUD
Row spanning using enableRowSpan property
The Syncfusion Grid introduces a simplified approach to vertically merge cells using the enableRowSpan property.
When the enableRowSpan property is enabled, the Grid automatically merges cells with matching data across adjacent columns without requiring manual span configuration using the queryCellInfo event. These merged cells are visually combined into a single cell, improving readability.
Here is an example of how to use the enableRowSpan property to merge cells vertically:
You can also control spanning at the column level. To prevent merging for specific columns, set
enableRowSpanto false in the column definition.
Limitation
- Virtualization
- Infinite Scrolling
- Lazy Load Grouping
- Row Drag and Drop
- Column Virtualization
- Detail Template
- Editing
- Export
- Foreign Key
- Hierarchy Grid