p-tree click on whole node

Discussão em 'Angular' iniciado por Anna Korotkova, Setembro 10, 2024.

  1. Please can anybody give me the idea, How to fix p-tree component that I can click on whole node, not only on toggle icon. I found that I can expanded root node by click like: @HostListener("click") onClick() { this.usersService.treeData[0].expanded=true;

    but how to define on which child element user clicked ?

    Please advise... p.s. Angular 14 PrimeNG.

    I tried to use style to catch it like: const elements = this.elementRef.nativeElement.querySelectorAll("p-tree"); elements.forEach( (element: any) => { this.renderer.listen(element, "click", event => { console.log('CLICK', element.nativeElement.label); but i can't define which child node was clicked.

    Continue reading...

Compartilhe esta Página