Skip to content

Commit

Permalink
fixed expand all trees bug #4162
Browse files Browse the repository at this point in the history
  • Loading branch information
hotzenklotz committed Jul 11, 2019
1 parent 05c12bd commit d4470d1
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -181,18 +181,23 @@ class TreeHierarchyView extends React.PureComponent<Props, State> {
};

setExpansionOfAllSubgroupsTo = (groupId: number, expanded: boolean) => {
const newExpandedGroupIds = Object.assign({}, this.state.expandedGroupIds);
const collapseAllGroups = groupTree => {
const copyOfGroupTree = _.cloneDeep(groupTree);
findTreeNode(copyOfGroupTree, groupId, item => {
forEachTreeNode(item.children, node => {
if (node.type === TYPE_GROUP) {
node.expanded = expanded;
newExpandedGroupIds[node.id] = expanded;
}
});
});
return copyOfGroupTree;
};
this.setState(prevState => ({ groupTree: collapseAllGroups(prevState.groupTree) }));
this.setState(prevState => ({
groupTree: collapseAllGroups(prevState.groupTree),
expandedGroupIds: newExpandedGroupIds,
}));
};

onMoveNode = (params: {
Expand Down

0 comments on commit d4470d1

Please sign in to comment.