Skip to content

Commit

Permalink
fix(Table): fix table swap data error
Browse files Browse the repository at this point in the history
  • Loading branch information
uyarn committed Aug 15, 2024
1 parent 27eca15 commit 1df9ce2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions js/table/tree-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,15 @@ class TableTreeStore<T extends TableRowData = TableRowData> {
}
if (count >= 2) break;
}
children[targetIndex] = params.target;
children[currentIndex] = params.current;
// 向后拖拽
if (currentIndex < targetIndex) {
children.splice(targetIndex + 1, 0, params.current);
children.splice(currentIndex, 1);
} else {
// 向前拖拽
children.splice(currentIndex, 1);
children.splice(targetIndex, 0, params.current);
}
}

return { dataSource, result: true };
Expand Down

0 comments on commit 1df9ce2

Please sign in to comment.