Description
What problem does this feature solve?
Problem Description
When using vertical cell merging, the current behavior merges cells with the same value even if their parent group in the previous column is different. This results in misleading groupings.
Given this data:
Category | Priority | City |
---|---|---|
A | High | San Francisco |
A | Medium | New York City |
B | Medium | Paris |
B | Low | Nice |
Current Behavior (Incorrect Merging)
Category | Priority | City |
---|---|---|
A | High | San Francisco |
Medium | New York City | |
B | Paris | |
Low | Nice |
Here, Priority: Medium
was merged even though it's used under both Category A and Category B.
This is incorrect, because the values belong to different groups.
Expected Behavior (Hierarchical Merging)
Category | Priority | City |
---|---|---|
A | High | San Francisco |
Medium | New York City | |
B | Medium | Paris |
Low | Nice |
In this version:
Priority
is only merged within the sameCategory
group.- This respects the hierarchical structure of the data.
Feature Request (☆▽☆)
Please support hierarchical vertical merging, where a cell in column n
is only merged if all previous columns (0 to n-1) have the same value for the affected rows.
This will ensure merged cells accurately reflect group boundaries and avoid misleading groupings in complex data tables.
What does the proposed API look like?
We suggest adding an optional flag or configuration to the table that enables hierarchical merging, where cells are only merged if all columns before them have the same value.
Option 1: mergeStrategy: 'hierarchical'
const table = new VTable({
...,
mergeStrategy: 'hierarchical',
});