Primefaces Treenode How to select father node only?

Is there anyways to select father node without its children in Primefaces treenode?

I am using Primefaces treenode to display a product category, but not all products belong to children categories. For example, a product belongs to category 1.1.1, but another belongs to 1.1.

I want to update the product's category, but when I select father node, its nodes will be selected too.

This is when I select father category:

enter image description here

This is what I want it to be:

enter image description here

Please help me, thank you.

p/s: I want to use checkbox.

Upvotes: 1

Views: 505

Answers (1)

Melloware
Melloware

Reputation: 12019

See the documentation: https://primefaces.github.io/primefaces/10_0_0/#/components/tree?id=tree

Look at the propagateSelectionUp and propagateSelectionDown properties. You want to turn them to false to get the behavior you want.

Upvotes: 3

Related Questions