Débora Cristina
Débora Cristina

Reputation: 65

How can I filter a p:tree

I built a tree using Primefaces JSF and I need to add a filter, where it update the data of the tree according to what the user typed. Does anyone know if this is possible ? I still can not find a solution.

Tree: http://www.primefaces.org/showcase/ui/data/tree/basic.xhtml

Upvotes: 3

Views: 3286

Answers (2)

meyquel
meyquel

Reputation: 2214

Primefaces Tree support filters since Primefaces 6.1

<p:tree value="#{treeBasicView.root}" filterBy="#{node}" var="node">
   <p:treeNode>
       <h:outputText value="#{node}" />
    </p:treeNode>
</p:tree>

https://www.primefaces.org/primefaces-6-1-final-released/

For older versions, see the other answer.

Upvotes: 3

Kukeltje
Kukeltje

Reputation: 12335

Before PrimeFaces 6.1 this was not possible IN the tree. On older versions just create an input field outside the tree and update the tree after calling a bean that server side updates the data for the tree based on the value of the input field.

Upvotes: 3

Related Questions