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

Make leaf node not expandable in tree regardless of children #6743

Closed
Eyowzitgoin opened this issue Oct 23, 2018 · 2 comments
Closed

Make leaf node not expandable in tree regardless of children #6743

Eyowzitgoin opened this issue Oct 23, 2018 · 2 comments
Assignees
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone

Comments

@Eyowzitgoin
Copy link

[ ] bug report => Search github for a similar issue or PR before submitting
[ x ] 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

Current behavior
When using the tree with nodes containing children, if the node has children, the expand caret will always show, regardless of "leaf" property value.

Expected behavior
If the node's "leaf" property is set to "true", then the node should not be expandable even if there are children on the node.

What is the motivation / use case for changing the behavior?
We've got a tree where there are a number of items a user can select by various properties and sub-properties (think a list of cars chosen by make and fuel-type). The users also have the ability to upload a custom list which wouldn't be arrived through the properties we supply (only 3 specific models of Ford). When the users load the new data, it is potentially in the hundreds of thousands of records and so we place it all under one node on the tree named "uploaded items" with a count of the items in that node but with no option to expand it (there is an option to export the data to a list should they need to review it). We expected to be able to set the "leaf" property for this node to "true" as we want this node to function as a leaf node. However the fact that this node has children is overriding the leaf property and displaying the node as expandable.

Please tell us about your environment:

  • Angular version: 5.2.9
  • PrimeNG version: 5.2.4
  • Browser: [all]
  • Language: [all]

  • Node (for AoT issues): node --version =

@cagataycivici cagataycivici added the Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add label Sep 24, 2019
@cagataycivici cagataycivici added this to the 8.1.0 milestone Sep 24, 2019
@lhysrc
Copy link

lhysrc commented Oct 12, 2019

After fix this, tree node is always leaf with lazy load mode.
image

@jmesa-sistel
Copy link
Contributor

My temporal fix:

// HACK to fix https://github.com/primefaces/primeng/issues/8237
// TODO remove when it is fixed
Tree.prototype.isNodeLeaf = (node) => node.leaf;

So I don't have to downgrade primeng.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants