-
1. rich:treeModelAdaptor iterating arrays
nimo22 Mar 10, 2011 4:25 AM (in response to nimo22)Okay, it was my fault, with that it works:
<rich:tree var="i"
<rich:treeModelAdaptor id="project" nodes="#{bean.list}"
<rich:treeNode
#{i.name
</rich:treeNode
</rich:treeModelAdaptor
</rich:tree>
So you see, I have to declare the var of my leaves at rich:tree and not at rich:treeModelAdapter. However, I dont understand that. According to example in rf-manual:
rich:tree>
<rich:treeNodesAdaptor id="project" nodes="#{loaderBean.projects}" var="project">
<rich:treeNode>
<h:commandLink action="#{project.click}" value="Project: #{project.name}" />
</rich:treeNode>the var is defined within the rich:treeModelAdapter (formerly named as rich:treeNodesAdapter).
-
2. rich:treeModelAdaptor iterating arrays
ilya_shaikovsky Mar 10, 2011 5:21 AM (in response to nimo22)we using single var for the whole tree component for simplicity purposes in first version. hovewer it's valid request for feature(probably different level nodes definitions will be clear with separate var) if think that not convinient.
P.S. will inform doc team about current unavailability. Thanks.
-
3. Re: rich:treeModelAdaptor iterating arrays
nimo22 Mar 10, 2011 5:42 AM (in response to ilya_shaikovsky)And is there a way to define static label for a node ?
For example:
<rich:tree var="i>
<rich:treeModelAdaptor id="project" nodes="#{bean.list} label="myNode"/>
<rich:treeNode>
#{i.name
</rich:treeNode>
</rich:treeModelAdaptor
</rich:tree>
It should render something like this:
myNode
..->leaf
..->leaf
The problem is that I use a simple ArrayList without a key, therefore I have no node in my list (only leafs). So I iterate through the arraylist and all the leafs are shown but without a node-label, therefore I can not toggle the leafs via a node, because no root-node for my leafs is visible.
-
4. Re: rich:treeModelAdaptor iterating arrays
ilya_shaikovsky Mar 10, 2011 5:50 AM (in response to nimo22)tree is dynamical by nature so we do not probide static nodes option at least for initial release. So easy way probably is to wrap your model adaptor with one more pointed to list with single object which contains "myNode"
-
5. rich:treeModelAdaptor iterating arrays
nbelaevski Mar 10, 2011 6:18 AM (in response to nimo22)Hi,
Use 'leaf' attribute.
-
6. Re: rich:treeModelAdaptor iterating arrays
nimo22 Mar 10, 2011 7:06 AM (in response to nbelaevski)Using this leaf="staticText" does not work, as Ilya said, it does not work for static content, so leaf have to be a list.
<rich:tree var="i>
<rich:treeModelAdaptor id="project" nodes="#{bean.list} leaf="staticText"/>
<rich:treeNode>
#{i.name}
</rich:treeNode
</rich:treeModelAdaptor>
</rich:tree>
Would be nice, if we can build a tree by static content without the need for using a backend list.
For example:
<rich:tree>
<rich:treeNode>
<h:commandLink value="node_1" ..
<rich:treeNode>
<h:commandLink value="leaf_from_1" ..>
</rich:treeNode>
..
</rich:treeNode>
<rich:treeNode>
<h:commandLink value="node_2" ..>
</rich:treeNode>
..
</rich:tree>
Actually, this is not possible. Am I right?