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

expandAll() method is very slow with large objects,even if virtual scroll is true #938

Open
poonamsinghlm opened this issue Mar 24, 2022 · 1 comment

Comments

@poonamsinghlm
Copy link

expandAll() method is very slow with large objects,even if virtual scroll is true.Is there any way do performance improvement with large data.

@rafaelceravolo
Copy link

I found a workaround, setting the expandedNodeIds and calling update() worked and is very fast!

Here 's the code to add in your component that uses the tree:

@ViewChild(TreeComponent)
  treeComponent: TreeComponent;

...

 expandAll() {
    // the native expandAll() of the treeCOmponent is very slow. Setting the expandedNodeIds is much faster
    this.treeComponent.treeModel.expandedNodeIds = {};
    this.treeComponent.treeModel.doForAll((node) => {
      this.treeComponent.treeModel.expandedNodeIds[node.id] = true;
    });

    // doing the update without a timeout was expanding just the first level, with timeout, the whole tree is expanded!
    setTimeout(() => {
      this.treeComponent.treeModel.update();
    });
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants