Feature: provide `elementRef` of node.
liesahead opened this issue · 2 comments
Describe any alternatives/workarounds you're currently using
We don't have tree-node
elements in our html, therefore a hack was needed to get that reference. Workaround is to set nodeClass
on each node and select it by classname later, but this feels hacky. Especially, when you see that in types
declaration there is an elementRef
and when you try to use it - it throws an error.
More detailed description of use-case here: #904.
If accepted, I would be willing to submit a PR for this feature
[ ] Yes (Assistance will be provided if you need help to submit a pull request)
[ X] No
The elementRef
always throws an error because that's hardcoded in there - it should have been removed a long time ago. It was removed because of the virtual scroll and there would be a few problems adding it back and having virtual scroll.
That workaround with the class and selecting it later does sound hacky. But why are you not using the template options?
Thanks for the reply. We use treeNodeTemplate
which is kind of enough for us. Adding more explicit template just to set some classnames or ViewChild
references seems like an overhead here. So it would be nice to get a reference somehow by node id or similar.