on 01-26-2008 11:39 PM
Hi All:
I need to know how can I go trough a recursive tree. I have a tree with various levels, each one with a checkBox associate to it. So, I have to know wick elements from the tree are checked or not.
Any ideas?
Thanks
Hi,
create a recursive function which takes the node as the parameter.
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Following Link might be of use for you.
http://help.sap.com/saphelp_nw70/helpdata/en/13/4cde139306304480e89d815ffcf891/frameset.htm
Regards
Ayyapparaj
Hi,
If your node structure is as follows
Parent--> Root of the tree
Child -> Recursive node which points to the Parent
Ex:
Iterate through the parent node Elements
for(int x=0; x< wdContext.nodeParent().size(); x++)
{
// get the element
IParentElement nodeElement = wdContext.nodeParent().getParentElementAt(x);
// get the child of the current element
IParentNode node = nodeElement.nodeChild();
}
If the concept is clear, convert the above one to a recursive function.
Regards
Ayyapparaj
Hi
I have in my context a CatalogEntries node with a recursive ChildNode and some value attributes like a text, isleaf, expanded and ischecked.
I have a TreeByNestingColumn that is bind with the text context attribute and another column with a checkBox that is bind with the ischecked context attribute.
The problem is that I need to go through the tree and check were the element is check or not, but I can´t get it. I tried to do a for of CatalogEntrie node but I just get the first node, the ROOT.
Any ideas how can I solve it?
regards
Aída
Well i made some time ago a routine for dynamic validation of mandatory fields which could navigate within context nodes and check their contents, but it has its limitations since i gotta give all the node names in order to reach certain attribute, maybe you could adapt it to check if it has childs then go deeper into tree, i never tried to navigate to a "parent" node yet, if that can be done then would be easier to achieve what u want.
Maybe it would be easy since its a tree and subnodes names are all the same. Probably making it recursive as Ayyapparaj suggested.
Just my humble opinion...
Regards.
Julio Herrera
CatalogEntries (node, 0:N, singleton=false)
-- ChildNode (rec. node -> CatalogEntries)
-- isChecked (boolean)
void visit(ICatalogEntriesElement entry)
{
if ( entry.isChecked() )
{
/* found checked tree node */
}
for (int i = 0; i < entry.nodeChildNode().size(); ++i)
{
visit( entry.nodeChildNode().getCatalogEntriesElementAt(i) );
}
}
visit( wdContext.nodeCatalogEntries().getCatalogEntriesElementAt(0) );
Armin
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.