on 07-30-2008 1:57 PM
Hello!
I am working on a webdynpro project with a classic model like: navigation (recursive tree in "TreeView") on the left and the main views on the right side.
The tree works well, I can initialize it with my data and on actionSelect I can change to the corresponding view on the right side.
The treeElements are bound to some data, I get from a JDBC database or XML file. It's built in the following way:
TreeNode
- hasChildren
- id (according to the database entity IDs)
- ignoreAction
- isExpanded
- parentElementId
- text
selectedElement
Of course, the user can navigate through the views by using buttons like "next" or "previous". In this case, I'd like to change the selection of the tree - according to the shown view.
I had the idea to implement it this way:
onPlugFromAnotherView(BigDecimal id) {
itereate through tree
if treeElement.getID().equals(id)
treeElement.setSelection;
}
...but I didn't found any methods like this. Is there a opportunity to do it like this? Or another way?
Greetings,
Ramó
One possibility would be to keep a map "treeNodeById" mapping each ID to the corresponding "tree node" (represented by the context element).
Then you could easily select a tree node from its ID:
void selectTreeNode(String id)
{
IWDNodeElement e = (IWDNodeElement) treeNodeById.get(id);
try
{
wdContext.nodeTreeNode().setTreeSelection(e);
}
catch (WDContextException x)
{
/* handle x */
}
}
The map could by created while building the context node that stores the tree nodes.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
One last question to this topic:
In case that the method selects a treeNodeElement, which is not visible, because it's parentNode is not expanded: Is it possible to expand the parentNode?
for example like:
IWDNodeElement e = (IWDNodeElement) treeNodeMap.get(elementId);
wdContext.nodeTreeNode().setTreeSelection(e);
e.getParentNode().setIsExpanded(true);
Greetings,
Ramó
Hello! No, in my application actually there is no way to expand the nodes to tree selection automatically.
But it sounds like it wouldn't be so difficult to implement this...
...ok, it wasn't really difficult. I just switched the "expanded" property of the TreeNodeType to "true".
thanks for your help!
Ramón
Edited by: Ramón Diegel on Jul 31, 2008 11:20 AM
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.