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

p-tree: Parent node always undefined in node selection events when Virtual Scrolling is enabled #12718

Closed
nitrousdigital opened this issue Mar 7, 2023 · 2 comments · Fixed by #15072
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@nitrousdigital
Copy link

nitrousdigital commented Mar 7, 2023

Describe the bug

event.node.parent is always undefined in onNodeSelect of a PrimeNG tree when virtual scrolling is enabled

Environment

Discovered in PrimeNG 11.4.10 and reproduced in 15.2.0 (see the attached stackblitz for a demo)

Reproducer

https://stackblitz.com/edit/primeng-treeselection-demo-yvxqt7?file=src/app/app.component.html

Angular version

14.1.3

PrimeNG version

15.2.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

16.13.2

Browser(s)

No response

Steps to reproduce the behavior

  1. Build a tree (without virtual scrolling enabled) and ensure all parent references are set in the TreeNode model instances.
  2. Select a node in the tree
  3. Notice that the event.node.parent will be defined for non-root nodes.
  4. Now change the display template for your tree, to enable virtual scrolling by adding the following to the <p-tree>
[virtualScroll]="true"
[virtualNodeHeight]="33"
scrollHeight="200px"
  1. Select a node in the tree
  2. Notice that now the event.node.parent will be undefined for all nodes.

Expected behavior

event.node.parent should contain a valid reference to the parent node for all non-root nodes, even when virtual scrolling is enabled.

@nitrousdigital nitrousdigital added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Mar 7, 2023
@nitrousdigital nitrousdigital reopened this Mar 7, 2023
@nitrousdigital nitrousdigital changed the title p-tree: Parent node always undefined in node selection events p-tree: Parent node always undefined in node selection events when Virtual Scrolling is enabled Mar 7, 2023
@ZawadaMatt
Copy link

Any news ?

@cetincakiroglu cetincakiroglu added this to the 17.12.0 milestone Mar 20, 2024
@cetincakiroglu cetincakiroglu 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 Mar 20, 2024
@cetincakiroglu
Copy link
Contributor

Fixed in #15072

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants