Hello Friends, I am new to myfaces tree2 component. I am trying to implement the an example given at
http://www.jroller.com/plainoldweblog/entry/use_tomahawk_tree2_and_ajax4jsf I am not able to expand the child node in the given example or any nodes added to child is not displayed. List childList = p_parentNode.getChildren(); TreeNode abc = new TreeNodeBase("folder", "MS Word Files", "302", false); List childList1 = abc.getChildren(); TreeNode abc1 = new TreeNodeBase("folder", "MS Word File 1", "3021", false); abc.getChildren().add(new TreeNodeBase("folder", "File 1", "3021", false)); abc.getChildren().add(new TreeNodeBase("folder", "File 2", "3022", false)); abc.getChildren().add(new TreeNodeBase("folder", "File 3", "3023", false)); childList1.add(abc1); childList.add(abc); Can somebody help me, I need to recursively expand the child node. I have given the source below. Thank you. Sudheer treeBean.java ============= public class TreeBean implements Serializable { private TreeModel treeModel; public TreeModel getTreeModel() { if(treeModel == null) { //you don't really have to initialize the treeModel here TreeNode root = new TreeNodeBase("folder", "root", "1", false); List<TreeNode> rootChildList = root.getChildren(); //constructs real folder tree TreeNode documents = new TreeNodeBase("folder", "Documents", "10", false); List<TreeNode> childList = documents.getChildren(); TreeNode home = new TreeNodeBase("folder", "User Home", "101", false); home.getChildren().add(new TreeNodeBase("folder", "user", "1011", false)); TreeNode tmp = new TreeNodeBase("folder", "Temporary", "102", false); tmp.getChildren().add(new TreeNodeBase("folder", "junks", "1021", false)); childList.add(home); childList.add(tmp); rootChildList.add(documents); treeModel = new TreeModelBase(root); } return treeModel; } /** * set folder tree model * @param p_treeModel */ public void setTreeModel(TreeModel p_treeModel) { treeModel = p_treeModel; } /** * This method listens to expand and collapse folder events. * @param p_event */ public void processToggle(ActionEvent p_event) { UIComponent component = (UIComponent) p_event.getSource(); while (!(component != null && component instanceof HtmlTree)) { component = component.getParent(); } if (component != null) { HtmlTree tree = (HtmlTree) component; TreeNode node = tree.getNode(); if (!tree.isNodeExpanded()) { loadChildren(node); } else { //unloadChildren(node); } } } /** * when tree node is expanded, this method will load its children * @param p_parentNode */ public void loadChildren(TreeNode p_parentNode) { List<TreeNode> childList = p_parentNode.getChildren(); //This is where you need to load the actual child nodes childList.add(new TreeNodeBase(p_parentNode.getType(), "folder"+System.currentTimeMillis(), p_parentNode.getIdentifier()+1, false)); } } tree.xhtml ========== ........... ........... <h:form id="ajaxform"> <h:panelGroup id="treePanel"> <t:tree2 id="tree" value="#{treeBacker.treeModel}" var="node" varNodeToggler="t" clientSideToggle="false" showRootNode="false" showNav="false" showLines="false"> <f:facet name="folder"> <h:panelGroup id="folderPanelGroup"> <!-- expand collapse --> <a4j:commandLink id="expandCollapseLink" immediate="true" styleClass="treeNode" reRender="treePanel" action="#{t.toggleExpanded}" actionListener="#{treeBacker.processToggle}"> <t:graphicImage style="border:0px" url="#{t.nodeExpanded ? '/images/yellow-folder-open.png' : '/images/yellow-folder-closed.png' }" /> </a4j:commandLink> <!-- load folder content --> <h:outputText value="#{node.description}" /> </h:panelGroup> </f:facet> </t:tree2> </h:panelGroup> </h:form> ........... ........... -- View this message in context: http://www.nabble.com/tree2-newly-inserted-child-nodes-not-displayed-tp15306460p15306460.html Sent from the MyFaces - Users mailing list archive at Nabble.com.