Primeng: Tree Not Updating Selection State on Parent Node

Created on 15 Aug 2017  路  8Comments  路  Source: primefaces/primeng

[X] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Plunkr Case (Bug Reports)
https://plnkr.co/edit/TH3juN334bA1TjeByeBM?p=preview

Current behavior
Parent node does not get checked.

image

Expected behavior
If you push a child node to the selection array, it should reflect on the parent node as if the child node was clicked.

Minimal reproduction of the problem with instructions
https://plnkr.co/edit/TH3juN334bA1TjeByeBM?p=preview

I've also tried manually firing the change detector but that did not work either.

What is the motivation / use case for changing the behavior?
Inconsistent behaviour

Please tell us about your environment:
Windows 10

  • Angular version: 2.0.X
    4.3.3

  • PrimeNG version: 2.0.X
    4.1.2

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
    ALL

  • Language: [all | TypeScript X.X | ES6/7 | ES5]
    ALL

All 8 comments

I ran into this bug as well, do you have any workarounds?

@banejo no workarounds right now unfortunately. Hopefully the PrimeNg tem can resolve this quickly (they are usually very fast).

I have the same problem.

Angular version: 4.4.6
PrimeNG version: 4.2.2

I am also experiencing the same issue using PrimeNG version 4.3.0.

Can I also request that the following is applied:

  1. when all children have been selected - the parent is then selected
  2. when at least one, but not all, children have been selected - the parent is marked as partialSelection = true

I have been able to get the behaviour for #2 above by setting partialSelection = true on the parent when creating my TreeNode array, but this still feels like a workaround for something that the TreeTable should do out of the box.

Thanks

Found a workaround for pre-selection of multiple check-boxes (programmatically) in primeng Tree. You can find working example here: https://github.com/jigneshkhatri/primeng-treenode-preselect

Any word on when this is going to be fixed?

Seeing this same behavior in 5.2.3. I select a child and the parent show partially selected. Then set selectedNodes=[], which unselects the child, but parent remains selected.

Also, is there any way to get the partially selected parent to show in the selectedNodes array? Seems like it only shows "fully" selected nodes, and not partially selected.

Sorry you have to do it on your side by setting partial selected as true for pre-selection, it is too expensive if the component does it.

https://github.com/jigneshkhatri/primeng-treenode-preselect

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Helayxa picture Helayxa  路  3Comments

papiroca-tm picture papiroca-tm  路  3Comments

miresk picture miresk  路  3Comments

mitosandov picture mitosandov  路  3Comments

KannanMuruganmony picture KannanMuruganmony  路  3Comments