Skip to content
This repository was archived by the owner on Apr 30, 2024. It is now read-only.

PublicApi

Chad Ramos edited this page Sep 4, 2018 · 8 revisions

When Pioneer Tree initializes, it expands the functionality of each node in your tree. By way of, you will have access to this expanded functionality through the public api exposed by Pioneer Tree.

pioneerTree

To access tree level operations, you need to to add a reference variable to your pioneer-tree component. For example, you can add #pt like so.

<ul pioneer-tree [configuration]="configuration" [nodes]="nodes" #pt>

Inside your parent component, of which houses pioneer-tree, grab a reference to your @ViewChild.

  @ViewChild('pt')
  pt: ViewChild : PioneerTreeComponent;

this.pt.pioneerTree.expandAllNodes()

Expands all nodes in your tree.

this.pt.pioneerTree.collapseAllNodes()

Collapses all nodes in your tree. You can optional supply a depth parameter to tell pioneer tree to collapse everything up to a certain depth in the tree.

  • Ability to specify the depth you want the collapseAllNodes() function to collapse to.
const depth = 1;
this.pt.ptree.collapseAllNodes(depth);

this.pt.pioneerTree.collapseAllExpandThisSetActive(node)

  1. Collapses all nodes.
  2. Expands expands the node passed in and all parents up to root level.
  3. Sets the node to the current tracked and active node.

this.pt.pioneerTree.getRawTree()

Returns your tree minus all expanded functionality.

this.pt.pioneerTree.getExpandedTree()

Returns your tree with all expanded functionality

pioneerTreeNode

The pioneerTreeNode object is tacked onto your node and can be access by the dot operator like so.

node.pioneerTreeNode

node.pioneerTreeNode.isCollapsed()

Determine if the node is current in a collapsed state. In a common context, collapsed means that the node's children are not viewable.

Clone this wiki locally