In the AfterPageLoad event of my custom navigator control add this:
try{
var newContainer:com.ibm.xsp.extlib.tree.impl.BasicContainerTreeNode = new com.ibm.xsp.extlib.tree.impl.BasicContainerTreeNode();
newContainer.setLabel("Dynamic Container Node");
var newNode:com.ibm.xsp.extlib.tree.impl.BasicLeafTreeNode = new com.ibm.xsp.extlib.tree.impl.BasicLeafTreeNode();
newNode.setLabel("Dynamic Basic Node");
newContainer.addChild(newNode);
var Nav = getComponent("nav1");
Nav.addNode(newContainer);
}catch(e){
print(e.toString);
}
'nav1' Navigator control
Improved version, use a Managed Bean (does not need to be managed can be just a class)
Java class:
package com.my.javaclass;
import java.io.Serializable;
import com.ibm.xsp.extlib.tree.ITreeNode;
import com.ibm.xsp.extlib.tree.impl.BasicLeafTreeNode;
import com.ibm.xsp.extlib.tree.impl.BasicContainerTreeNode;
import com.ibm.xsp.extlib.tree.impl.BasicNodeList;
public class javaclass extends BasicNodeList implements Serializable {
private static final long serialVersionUID = -7600042596799645230L;
public javaclass() {
BasicContainerTreeNode newContainer = new BasicContainerTreeNode();
newContainer.setLabel("Dynamic Container Node");
BasicLeafTreeNode newNode = new BasicLeafTreeNode();
newNode.setLabel("Dynamic Basic Node");
newNode.setSubmitValue(/*some value you want to submit*/);
newNode.setSelected(/*some boolean function*/);
newContainer.addChild(newNode);
addChild(newContainer);
}
}