Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: not work correctly when the row span is 1 (fix #1767) #1913

Merged
merged 1 commit into from
May 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/toast-ui.grid/src/dispatch/rowSpan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ export function updateRowSpanWhenAppending(data: Row[], prevRow: Row, extendPrev
const startOffset = keyRow || extendPrevRowSpan ? 1 : -count + 1;

// keep rowSpan state when appends row in the middle of rowSpan
if (mainRowSpan.spanCount > startOffset) {
if (
mainRowSpan.spanCount > startOffset ||
(mainRowSpan.spanCount === 1 && startOffset === 1)
) {
mainRowSpan.count += 1;
mainRowSpan.spanCount += 1;

Expand Down
3 changes: 2 additions & 1 deletion packages/toast-ui.grid/src/store/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,8 @@ function createSubRowSpan(prevRowSpanMap: RowSpanMap) {
Object.keys(prevRowSpanMap).forEach((columnName) => {
const prevRowSpan = prevRowSpanMap[columnName];
const { mainRowKey, count, spanCount } = prevRowSpan;
if (spanCount > 1 - count) {

if (spanCount > 1 && spanCount > 1 - count) {
const subRowCount = count >= 0 ? -1 : count - 1;
subRowSpanMap[columnName] = createRowSpan(false, mainRowKey, subRowCount, spanCount);
}
Expand Down
Loading