Hi Guys,
here is the coding,
<f:view>
<rich:tree value="#{treeManagedBean.nodes}" var="node" adviseNodeOpened="true">
<rich:treeNode>
<h:outputText value="#{node}" />
</rich:treeNode>
</rich:tree>
</f:view>
public class TreeManagedBean {
private TreeNodeImpl<String> rootAdmin = new TreeNodeImpl<String>();
private TreeNodeImpl<String> rootAccounts = new TreeNodeImpl<String>();
private TreeNodeImpl<String> rootOther = new TreeNodeImpl<String>();
private TreeNodeImpl<String> rootChangePwd = new TreeNodeImpl<String>();
private TreeNodeImpl<String> nodes = new TreeNodeImpl<String>();
private Collection<String> collection = null;
/**
*
*/
public TreeManagedBean() {
rootAdmin.setData("Administrator");
rootAccounts.setData("Accounts");
rootOther.setData("Other");
rootChangePwd.setData("Change Password");
nodes.addChild(0, rootAdmin);
nodes.addChild(1, rootAccounts);
nodes.addChild(2, rootOther);
nodes.addChild(3, rootChangePwd);
TreeNodeImpl<String> childCompany = new TreeNodeImpl<String>();
childCompany.setData("Company");
rootAccounts.addChild(0, childCompany);
TreeNodeImpl<String> childLicence = new TreeNodeImpl<String>();
childLicence.setData("Licence Management");
rootAccounts.addChild(1, childLicence);
TreeNodeImpl<String> childFunction = new TreeNodeImpl<String>();
childFunction.setData("Functions");
rootAccounts.addChild(2, childFunction);
TreeNodeImpl<String> childRoles = new TreeNodeImpl<String>();
childRoles.setData("Roles");
rootAccounts.addChild(3, childRoles);
TreeNodeImpl<String> childCountry = new TreeNodeImpl<String>();
childCountry.setData("Country");
rootOther.addChild(0, childCountry);
}
// getters and setters goes here....
}
Problem is Tree is generating in the UI successfully, but when i click the folder icon its not collapsing...
Can someone please guide me?Its solved now! i had to remove the extra <f:view> there.. thats all :)