angular-tree-component: Slow preformance on expand and select checkboxes
Hi,
I know there are ALOT of posts related to this issue but I still didn’t find a proper answer for this problem.
I’m using this (GREAT ! ) module with nodes list ~10K .
When trying to select a checkbox with a list of >1K - the system is lagging.
In addition , using treeModel.expandAll() - is also lagging.
Also programically using those lines are codes are showing poor preformance :
selectAllNodes() {
const firstNode = this.tree.treeModel.getFirstRoot();
firstNode.setIsSelected(true);
}
deselectAllNodes() {
const firstNode = this.tree.treeModel.getFirstRoot();
firstNode.setIsSelected(false);
}
It is not clear if there is some kind of fix for those problems in the near future (or not…).
About this issue
- Original URL
- State: open
- Created 6 years ago
- Comments: 23 (4 by maintainers)
Hello I don’t know if it helps but also with huge trees expandAll and collapseAll can be quite fast with some drawbacks which @adamkleingit may be able to find and explain.
One problem is that no event is fired for the expand and collapse but this may not be a problem for you
I know this thread is old but I run into same issue. Here’s snippet for checkbox performance issue (Select all) that you can pass with options I managed to reduce delay from 5-10 sec to ~160ms (I have ~2.5k elements in tree).
This works fast: this.tree.treeModel.doForAll((node: TreeNode) => node.isSelected && node.setIsSelected(false));
@nshelms I had a look in the code but please be aware I’m not a contributor of this project, I’m just user of this lib as you are. So I can’t tell you which unwanted side effects this has. And as long as Adam or any other official contributor with knowledge of the code tells something about this, my ideas can bring more harm then help.
So in the treeModel class there is the method/function
So i assume that you may do the same as in my expand all method.
I haven’t tested this code at all, so please try to run it yourself. I just had a look in the code and made some assumptions. Maybe this isn’t working at all
BW