How to present a RichFaces tree with an already defined node

I have a JSF page that displays a TreeView TreeView from the TreeNodeImpl model generated in a bean backup.

Now I want the page to first display with a specific node extended / selected. Preferably this extension should be controlled using a bean (without javascript wizardry)

The entire tree was created during initialization of the bean database

Is it possible? I saw a mention of TreeState, is this the way to go?

+4
source share
1 answer

<rich:tree> has the adviseNodeOpened property ( here)

It should contain javax.el.MethodExpression . The signature of the target method must match

 java.lang.Boolean adviseNodeOpened(org.richfaces.component.UITree) 

This is documented as:

The Binding method points to a method that accepts org.richfaces.component.UITree with a return of type java.lang.Boolean. If the return value is: java.lang.Boolean. TRUE, a particular treeNode is incremented; java.lang.Boolean.FALSE defined treeNode collapsed; null, specific treeNode saves current state

+5
source

Source: https://habr.com/ru/post/1305533/


All Articles