I'm trying to add nodes dynamically to an Extension Library Accordion control. The whole idea is to build a menu with its options being brought from a view (view entries). I started with a very basic logic which I got from here (thanks to this guy Kraeven X BTW). I declared a variable of type accordion, and then created a new instance of BasicContainerNode, and BasicLeafNode. Everything worked fine, I was able to add the the BasicLeafNode as a child of the BasicContainerNode and set the labels for both. The problem started when I tried to add the newly created node (and its child) to my accordion control using the addNode(ITreeNode node) method. The page crashes with an Error 500 (HTTP Web Server: Command Not Handled Exception).
Any Ideas why the addNode(ITreeNode node) method ain't working?? What am I doing wrong???
Here's the SSJS code in my afterPageLoad:
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.setHref("http://www.google.com");
newNode.setLabel("Dynamic Basic Node");
newContainer.addChild(newNode);
var acc = getComponent("accordion1");
acc.addNode(newContainer);
}catch(e){
print(e.toString);
}
Thanks in advance for any help.
:)