Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component: p-tree (selection) #15761

Closed
vrjaroslav opened this issue May 30, 2024 · 0 comments · Fixed by #15991 · 4 remaining pull requests
Closed

Component: p-tree (selection) #15761

vrjaroslav opened this issue May 30, 2024 · 0 comments · Fixed by #15991 · 4 remaining pull requests
Assignees
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

Comments

@vrjaroslav
Copy link

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

@vrjaroslav vrjaroslav added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label May 30, 2024
@mehmetcetin01140 mehmetcetin01140 self-assigned this Jul 10, 2024
@mehmetcetin01140 mehmetcetin01140 added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Jul 10, 2024
@mehmetcetin01140 mehmetcetin01140 added this to the 17.18.4 milestone Jul 10, 2024
cetincakiroglu added a commit that referenced this issue Jul 11, 2024
Fixed #15761 - Component: p-tree (selection)
@mehmetcetin01140 mehmetcetin01140 added LTS-PORTABLE Issue's fix will be ported to supported LTS versions LTS-FIXED-15.4.23 labels Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment