angular-tree-component: Cannot set property 'scrollTop' of null
Angular 2.4.8 Angular2-tree-component 3.1.0
Hi. After upgrading from 2.7.0 to 3.1.0 i got some issue. When i try to do this:
this.itemsTree.treeModel.getNodeById('abc').setActiveAndVisible(true);
i got error: “Cannot set property ‘scrollTop’ of null”
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 20 (9 by maintainers)
If you need a workaround until this gets sorted out, surround the “display” request with a setTimeout(). It’s working for me.
Still happening for me with 3.7.2. Probably my situation is unique - the tree is within an *ngIf. It’s initially hidden until data is retrieved from our server and a manual change detection is called. @SnackyPete’s workaround to use a setTimeout works for me and I’m happy with that, but thought I’d mention it in case anyone else is still having this issue.