on 06-01-2009 7:26 AM
Hello all,
I have a requirement wherein for a input field there will a value help which is a customed designed pop up window. In this pop up there will be a tree ui element in which i need that a user can only select the leafs. This means when a user selects a leaf that value should be written in input field.
What is the behaviour of the tree ui element by default. Does it allow selection of a leaf element only by default or do i require custom coding here for my requirement?
Please help.
If you can help me with sample code that would be very beneficial.
Thanks all of you for your inputs
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The steps performed were:
1) Create a Tree Popup window
2) Create a tree element on the view in the window
3) Populate the tree dynamically with MDM data recursively.
4) Keep a boolean attribute hasChildren
5) Set the above attribute when data is leaf/node
6) Use the above attribute on the onAction event of tree
7) Enable Ok button on the view only when data is leaf
😎 Once leaf is selected user pushes OK button and data selected is populated to the main window input field using context mapping.
Regards,
Yogesh Bhatia
You could try this: Bind the "ignoreAction" property of the TreeNodeType to a boolean context attribute inside your recursive context (under data source node). Set the attribute value to false for inner nodes and to true for leaves. Assign an action handler to the TreeNodeType, add an action parameter "treeNode" of type I<DataSourceNode>Element, map event parameter "nodeElement" to action parameter "treeNode".
That should give you a tree where only the leaves are rendered as links and when clicking a leaf, the action parameter will contain the context element representing the leaf.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You mentioned that user can only select the leaf node.
What kind of selection do you want to give to user:
1. Table row select - As per my knowledge its not possible to control the table row select like for some of the rows(leafs) it should be selected and for some of the rows(parents) if should not be.
2. Changing the Table Cell Editor Dynamically
3. You can have Button or LinkToAction as UI elements for a particular column and you can enable them only for the rows where isLeaf=true.
Hope this gives you some idea.
Regards,
Charan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Charan,
Thanks for your quick reply. I really appreciate it.
Views on your view points:
Point 1: Table Row Select. Here tree is not embedded within table element. Its independent. Do we need to embed it in table necessarily?
Point 3: Button enablement on isLeaf=true. Is is the isLeaf property available as standard or do we have to make it from a context attribute? How do i make it?
Regards
Hi,
I don't think you need to embed the tree in table.
Hope u have already seen this tutorial, the tutorial mentions abt displaying the selected leaf in the text view.Porbably you can follow the same procedure. Some coding is done wdModifyView for the same
Hi,
It is not required to embed the table in table. You can implement it at outside the table as well.
Regarding isLeaf property:
Right now how are you identifing your leaf nodes? How will you say this element is leaf and it does not have any more childs?
I think if you had followed the approach in below pdf, then that attribute is "HasChildern" and method is setHasChildren(true);
Regards,
Charan
public void CreateHierTree( com.sap.mdm.data.HierNode hierNode, com.syngenta.function.wdp.IPrivateFunctionView.IVn_ParentNodeElement parentElement )
{
//@@begin CreateHierTree()
if(hierNode != null && hierNode.getChildren() != null)
{
for(int iChildCount=0 ; iChildCount < hierNode.getChildren().length ; iChildCount++)
{
IPrivateFunctionView.IVn_ParentNodeElement obj = parentElement.nodeVn_ChildNode().createVn_ParentNodeElement();
obj.setVa_Name(hierNode.getChildren()[iChildCount].getDisplayValue().toString());
obj.setVa_RecId(hierNode.getChildren()[iChildCount].getId().id);
parentElement.nodeVn_ChildNode().addElement(obj);
this.CreateHierTree(hierNode.getChildren()[iChildCount],obj);
}
}
//@@end
}
This is my code which am using to populate the tree recursively. can i have an additional isLeaf property and set it to true?
On action of the tree should i check the node elements for the attribute and see its value?
Is it not possible that i keep the node disabled using some property of tree and leafs are automatically enabled?
Edited by: Yogesh Bhatia on Jun 1, 2009 1:40 PM
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.