Skip to content

Commit

Permalink
fix: treeTable can not expand properly after folding all nodes (#1729)
Browse files Browse the repository at this point in the history
* fix: Table fold all

* chore: remove console

---------

Co-authored-by: sheepluo <sheepluo@tencent.com>
  • Loading branch information
chaishi and sheepluo authored Feb 25, 2024
1 parent a8f1fd7 commit 0be283e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion js/table/tree-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,15 +577,17 @@ class TableTreeStore<T extends TableRowData = TableRowData> {
*/
foldAll(dataSource: T[], keys: KeysType) {
const newData: T[] = [];
let index = 0;
for (let i = 0, len = dataSource.length; i < len; i++) {
const item = dataSource[i];
const rowValue = get(item, keys.rowKey);
const state = this.treeDataMap.get(rowValue);
state.rowIndex = state.level === 0 ? i : -1;
state.rowIndex = state.level === 0 ? index : -1;
state.expanded = false;
state.expandChildrenLength = 0;
if (state.level === 0) {
newData.push(item);
index += 1;
}
const children = get(item, keys.childrenKey);
if (children?.length) {
Expand Down

0 comments on commit 0be283e

Please sign in to comment.