In Primefaces I would like to expand a `<p:treeNode>`, when i click on its label, not when i click on the little triangle. 
Cant find any .xhtml document, but found that nodes are created this way:

```
...
final TreeNode parentNode = this.addNode(false, "Parent", this.root, targetView1); //first parameter means start expanded or not
this.addNode(, "ChildNode", parentNode, "targetView2");
...

```

Is it possible? Thank you.
['https://Stackoverflow.com/questions/43408454', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4419468/']
The easiest way is to add some JavaScript to trigger the triangle on node click:

```
 <p:tree onNodeClick="$(node).find('.ui-tree-toggler').click();" ...

```

You may also want to apply the following style to get a hand symbol while hovering:

```
.ui-tree-toggler ~ .ui-treenode-label
{
  cursor:pointer;
}

```
Add [selection](https://www.primefaces.org/showcase/ui/data/tree/selection.xhtml) to your viewer:

```
[(selection)]="selectedTreeNode"
(onNodeSelect)="onNodeSelect($event)"

```

Define your value in your controller:

`selectedTreeNode: TreeNode;`

Handle `onNodeSelect()`:

```
onNodeSelect(event: any) {
    this.selectedTreeNode.expanded = !this.selectedTreeNode.expanded;
}

```

Cheers!