on 05-30-2006 5:25 AM
Hi,
We are using a Tree UI element in one of our views, we have created a recursive & reloadable tree.
The tree is being displayed correctly with all the nodes & on clicking the parent node the child is displayed correctly.
Now, can somebody please tell me how to close a node that was opened previously when another node is clicked.
Say for ex:
If my tree has got parent nodes as Cricket, Soccer, & Tennis, each with their child nodes respectively,
Now that If I click Cricket then it's child node is displayed correctly , but then If I click the parent node named Soccer , though the child nodes of Soccer are correctly displayed in the tree, I want to know that when I click Soccer , the previously opened parent nodes should be closed.
i.e Only one parent node when selected should be open & all other parent nodes in the tree should be closed.
Can somebody please help me with this problem. Thanks in advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Store the reference of the openend node in a conttext variable. On click to open next node, set the isExpanded property of the previous node as false with the help of the context variable which has the reference of the previous node.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I have set the reference of the open node in a context variable as u said and Is expanded property as well. I have given the code here, please correct where i am going wrong.
public void addChildren( com.cpt.tree.sen.wdp.IPrivateTreeSenView.IFolderContentElement parent )
{
...
wdContext.currentContextElement().setElementExpanded(parent.index());
}
public void onActionLoadChildren(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, com.cpt.tree.sen.wdp.IPrivateTreeSenView.IFolderContentElement element )
{
IPrivateTreeSenView.IFolderContentNode folderContentNode =publicFolderContentNode;
if(wdContext.currentContextElement().getElementExpanded() != -1) {
IPrivateTreeSenView.IFolderContentElement nodeElement= folderContentNode.getFolderContentElementAt(wdContext.currentContextElement().getElementExpanded());
nodeElement.setIsExpanded(false);
}
}
IPrivateTreeSenView.IFolderContentNode publicFolderContentNode = null;
Thanks,
Regards,
Senthil Kumar S.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.