Component: p-tree (selection) #15761
Labels
LTS-PORTABLE
Issue's fix will be ported to supported LTS versions
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
Describe the bug
Hi,
I found bug on component Tree. The issue start in the version 17.3.1. The problem is the in method onNodeSelect. In that method is console.log for print selected note ([(selection)]),
but it prints previously selected node and not currently selected node. So if I click on Node1, then it print undefined, then if I click on Node2, then it print Node1.
In version 17.3.0 the behaviour is right, so if I click on Node1, then it print in method onNodeSelect exactly Node1 as selected node
` <p-tree
[value]="files"
class="w-full md:w-30rem"
selectionMode="single"
[(selection)]="selectedFile"
(onNodeSelect)="nodeSelect()" />
nodeSelect() {
console.log(this.selectedFile?.label);
}
`
You can find it here:
https://stackblitz.com/edit/hlj6vh-xevnpg?file=src%2Fapp%2Ftree-single-demo.ts
Environment
Windows 10
Reproducer
https://stackblitz.com/edit/hlj6vh-xevnpg?file=src%2Fapp%2Ftree-single-demo.ts
Angular version
17.3.6
PrimeNG version
17.3.1
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
20.9.0
Browser(s)
No response
Steps to reproduce the behavior
No response
Expected behavior
No response
The text was updated successfully, but these errors were encountered: