我写了一个简单树,但是无法展开,只能显示根节点,帮忙看看哪里的问题:
jsp:
<f:view>
<t:tree2 id="clientTree" value="#{tree.treeData}" var="node" varNodeToggler="t" showRootNode="false">
<f:facet name="menu">
<h:panelGroup>
<f:facet name="expand">
<t:graphicImage value="images/person.png" rendered="#{t.nodeExpanded}" border="0"/>
</f:facet>
<f:facet name="collapse">
<t:graphicImage value="images/person.png" rendered="#{!t.nodeExpanded}" border="0"/>
</f:facet>
<h:outputText value="#{node.description}" styleClass="nodeFolder"/>
</h:panelGroup>
</f:facet>
<f:facet name="item">
<h:panelGroup>
<h:commandLink immediate="true" styleClass="#{t.nodeSelected ? 'documentSelected':'document'}" actionListener="#{t.setNodeSelected}">
<t:graphicImage value="images/document.png" border="0"/>
<h:outputText value="#{node.description}"/>
</h:commandLink>
</h:panelGroup>
</f:facet>
</t:tree2>
</f:view>
-------------------------------------
Tree.java:
public TreeNode getTreeData()
{
TreeNode treeData = new TreeNodeBase("root", "根", false);
// construct a set of fake data (normally your data would come from a database)
// populate Frank's portion of the tree
TreeNodeBase menuNode = new TreeNodeBase("menu", "产品管理", false);
menuNode.getChildren().add(new TreeNodeBase("item", "锦囊", true));
treeData.getChildren().add(menuNode);
// populate Betty's portion of the tree
menuNode = new TreeNodeBase("menu", "后缀管理", false);
menuNode.getChildren().add(new TreeNodeBase("item", "神秘园", true));
treeData.getChildren().add(menuNode);
menuNode = new TreeNodeBase("menu", "用户统计", false);
menuNode.getChildren().add(new TreeNodeBase("item", "伊甸园", true));
treeData.getChildren().add(menuNode);
menuNode = new TreeNodeBase("menu", "其它", false);
menuNode.getChildren().add(new TreeNodeBase("item", "预警设置", true));
treeData.getChildren().add(menuNode);
return treeData;
}
回复 更多评论