Hi there,
I'm having some issues combining lazy loading with checkboxes. Checking a node with hasChildren: true when the children are not loaded yet causes an exception. See plunkr:
https://plnkr.co/edit/wigPSzzk3R0XM9RE173D?p=preview
Steps to reproduce:
SecondChild has one async loaded child and is not checked after expanding.
After all the async children are loaded the issue disappears.
Is there a way to work around this or is this a bug?
Stack trace from plunkr:
ERROR TypeError: Cannot read property 'forEach' of undefined
at e.setIsSelected (VM630 [email protected]:1)
at eval (VM630 [email protected]:1)
at Array.forEach (<anonymous>)
at ObservableArray.eval (VM672 mobx@^3:697)
at e.setIsSelected (VM630 [email protected]:1)
at e.toggleSelected (VM630 [email protected]:1)
at TOGGLE_SELECTED (VM630 [email protected]:1)
at e.mouseAction (VM630 [email protected]:1)
at Object.eval [as handleEvent] (VM674 e.ngfactory.js:13)
at handleEvent (VM627 core.umd.js:13620)
Thanks for the work on the tree component and looking forward to hearing from you.
+1
+1. Has there been any updates on this issue?
Here is a fix that I have issued in a local branch. I attempted to push this up to the repo in a new branch but access was denied
In tree-node.model.ts / setIsSelected
setIsSelected(value) {
if (this.isLeaf || !this.children) {
this.treeModel.setSelectedNode(this, value);
} else {
this.children.forEach((child) => child.setIsSelected(value));
}
return this;
}
+1
@jlewisitv Could you success to commit it?
@ilyagelman could you please consider it?
I have faced to it too. I don't know there is other solutions or not! but I think that it should be right.
I could not create a new branch and push I was unauthorised and therefor could not create a pull request
Most helpful comment
Here is a fix that I have issued in a local branch. I attempted to push this up to the repo in a new branch but access was denied
In
tree-node.model.ts / setIsSelected