on 05-29-2009 6:29 AM
Hello all,
I have a requirement of showing a MDM Hierarchy Table into Tree UI element.
These are the steps am following:
1) MDM Connectivity
2) Using RetrieveLimitedHierTreeCommand command to retrieve tree structure of the table
3) Using getChildren() method of each node to get the children
4) Made a tree ui element with a recursive node
Now since the Hierarchy table can reach any level of nodes how do i write code for dynamic tree node/leaf generation?
Please guide me through with detailed steps/code if possible?
Regards,
Yogesh Bhatia
Hello Arafat. I have one more requirement. I want to have a Tree such that only when its leaves are selected i should perform an action. However the recursive code you have given does not let me do that. I need to define nodes/leaves. I am using a context attribute boolean within my <Data Source> node for the same. Now in my recursive function how do i set the value of the attribute (boolean) so that for each node element (data about tree) i am aware that certain element is a leaf or a node. Can you kindly help me?
Regards,
Yogesh Bhatia
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Yogesh,
After getting the HierNode you have to recursively populate the hierarchy tree using the below code:
private void createHierarchyTree( parent_element, com.sap.mdm.data.HierNode HierNode)
{
if(HierNode != null && HierNode .getChildren() != null)
{
for(int iChildCount=0 ; iChildCount < HierNode .getChildren().length ; iChildCount++)
{
IPublic<comp name>.Iparent_element objTreeElement = parent_element.node<Recursive node name>().create<name>Element();
objTreeElement.setattr1(HierNode.getChildren()[iChildCount].getDisplayValue());
objTreeElement.setattr1_Recid(HierNode.getChildren()[iChildCount].getId().id);
parent_element.node<Recursive node name>().addElement(objTreeElement);
// call the method recursively
createHierarchyTree(objTreeElement, HierNode.getChildren()[iChildCount]);
}
}
}
This will populate the tree, you need to create an action in the tree view and link it to TreeNode Type action property using which you can get the selected value.
Hope this helps!!
Cheers,
Arafat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Yogesh,
I am using the below node structure in my solution:
ParentNode (Cardinality 0..n)
|___ Recursive node(repeatedNode property should point to ParentNode)
|___ Attr1 (String)
|___ Attr1_RecId(integer)
parent_element refers to the element of ParentNode created before calling the createHierarchyTree method.
Let me know if you have any other queries.
Cheers,
Arafat
Hi Yogesh,
You can create the element like below:
objHierNode is the object you got using APIS from MDM.
IPublic<ControllerName>.IParentNodeElement parent_element = wdContext.nodeParentNode().createParentNodeElement();
Assign the values to the attributes of the node element:
parent_element.setAttr1("Hierarchy"); // this is the name you want to give to hierarchy
parent_element.setAttr1_RecId(objHierNode.getId().id);
wdContext.nodeParentNode().addElement(parent_element);
this.createHierarchyTree(objHierNode, parent_element);
Hope this helps!!
Cheers,
Arafat
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.