Skip to content

Expanding specific node on ngAfterViewInit #950

Description

@bartoooon

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(); }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions