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

Expanding specific node on ngAfterViewInit #950

Open
bartoooon opened this issue Dec 1, 2022 · 0 comments
Open

Expanding specific node on ngAfterViewInit #950

bartoooon opened this issue Dec 1, 2022 · 0 comments

Comments

@bartoooon
Copy link

Hello,
I am following the angular-tree-component/guide more specifically where it explains how to expand nodes on init (https://circlongroup.github.io/angular-tree-component/guides/expanding)

I am trying to open a specific (mocked at the moment) node by using: this.tree.treeModel.getNodeById(64333);
but i can't make it work... i keep getting that "someNode" is undefined

this is my tree:
<tree-root #tree (focus)="focusNode($event)" (toggleExpanded)="onExpand($event)" (moveNode)="onMoveNode($event)" [nodes]="nodeList" [options]="options" class="tree-wrapper bold-node-text level1-document-icon-only m-b-20"> . . . . </tree-root>

ts:
@ViewChild('tree') tree; ngAfterViewInit() { const someNode = this.tree.treeModel.getNodeById(64333); someNode.expand(); }

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

1 participant