on 02-13-2009 4:22 PM
Hi All,
I am able to populate my tree UI element but the problem i am facing can be illustrated as follows:
wut exactly I req:
A-> a1, a2, B -
here A,B,C are nodes and a1, a2, b1, b2, b3 and c1 are attributes of A, B, and C nodes respectively
here A, B should be expandable nodes n C is the base which is not expandable.
but the resul I am getting is:
A is cummin fine it is expandable B only first element for each A is cumming expandable but rest of b non expandable. and all C is cumming under the first B expandable instead of cummin under the different B as it is supposed to.
I am pasting the code below:
if(firstTime)
{
try
{
IWDResourceHandler resourceHandlerForTree = null;
resourceHandlerForTree = WDResourceHandler.createResourceHandlerForCurrentSession();
IPrivateTreeView.IVn_FolderContentNode rootFolderContentNode =
wdContext.nodeVn_FolderContent();
IPrivateTreeView.IVn_FolderContentElement rootFolderContentElement;
if(wdContext.nodeVn_Roles().size()!=0)
{
for(int i=0;i<wdContext.nodeVn_Roles().size();i++)
{
rootFolderContentElement =rootFolderContentNode.createVn_FolderContentElement();
rootFolderContentElement.setText(wdContext.nodeVn_Roles().getVn_RolesElementAt(i).getVa_RoleDesc());
rootFolderContentElement.setHasChildren(true);
rootFolderContentElement.setIgnoreAction(true);
rootFolderContentNode.addElement(rootFolderContentElement);
if(wdContext.nodeVn_Roles().getVn_RolesElementAt(i).nodeVn_Entlmt().size()!=0)
{
//strt
for(int j=0;j<wdContext.nodeVn_Roles().getVn_RolesElementAt(i).nodeVn_Entlmt().size();j++)
{
IPrivateTreeView.IVn_FolderContentNode folderContentNode = rootFolderContentElement.nodeVn_ChildNode();
IPrivateTreeView.IVn_FolderContentElement folderContentElement;
folderContentElement = folderContentNode.createVn_FolderContentElement();
folderContentElement.setText(wdContext.nodeVn_Roles().getVn_RolesElementAt(i).nodeVn_Entlmt().getVn_EntlmtElementAt(j).getVa_EntlmtDesc());
folderContentElement.setHasChildren(true);
folderContentElement.setIgnoreAction(true);
folderContentElement.setIsExpanded(true);
folderContentNode.addElement(folderContentElement);
if(wdContext.nodeVn_Roles().getVn_RolesElementAt(i).nodeVn_Entlmt().getVn_EntlmtElementAt(j).nodeVn_Authcode().size()!=0)
{
IPrivateTreeView.IVn_FolderContentNode folderContentNode1 =folderContentNode.nodeVn_ChildNode();
IPrivateTreeView.IVn_FolderContentElement folderContentElement1;
for(int k=0;k<wdContext.nodeVn_Roles().getVn_RolesElementAt(i).nodeVn_Entlmt().getVn_EntlmtElementAt(j).nodeVn_Authcode().size();k++)
{
folderContentElement1 = folderContentNode1.createVn_FolderContentElement();
folderContentElement1.setText(wdContext.nodeVn_Roles().getVn_RolesElementAt(i).nodeVn_Entlmt().getVn_EntlmtElementAt(j).nodeVn_Authcode().getVn_AuthcodeElementAt(k).getVa_AuthcodeDesc());
folderContentElement1.setHasChildren(false);
folderContentElement1.setIgnoreAction(false);
folderContentElement1.setIsExpanded(false);
folderContentNode1.addElement(folderContentElement1);
}
}
}
here Roles node is the parent node ie A , entlmt node is B and C is authcode node.
B is cummin in correct level but not all B's are expandable where as according to my data source all B's should be expandable
Please provide some assistance.
Thanks & Regards
Jaspreet Kaur
Hi Jaspreet Kaur ,
The problem that you are facing is because of lead selection in your recursive node. I was able to reproduce the problem that you mentioned using the code that you provided. The problem lies in the way you fill data to the recursive context node.
while getting the child node for the second level you were using the code provided below.
IPrivateTreeView.IVn_FolderContentNode folderContentNode1 =folderContentNode.nodeVn_ChildNode();
Here you are using a node to get the child node. In this scenario the leadselected elements childnode will be taken. In your case you were not changing the leadselection and hence the child elements always got added to the second level first element.
The code should look like this
IPrivateTreeView.IVn_FolderContentNode folderContentNode1 =folderContentElement.nodeVn_ChildNode();
I had done the implementation to verify the problem. You can use the code given below or change the line above in your code.
if(firstTime)
{
IPrivateTreeView.IVn_FolderContentNode rootFolderContentNode = wdContext.nodeVn_FolderContent();
IPrivateTreeView.IVn_FolderContentElement rootFolderContentElement;
for(int i=0;i<wdContext.nodeVn_Roles().size();i++)
{
wdContext.nodeVn_Roles().setLeadSelection(i);
rootFolderContentElement =rootFolderContentNode.createVn_FolderContentElement();
rootFolderContentElement.setText(wdContext.nodeVn_Roles().getVn_RolesElementAt(i).getVa_RoleDesc());
rootFolderContentElement.setHasChildren(true);
rootFolderContentElement.setIgnoreAction(true);
rootFolderContentElement.setIsExpanded(true);
rootFolderContentNode.addElement(rootFolderContentElement);
rootFolderContentNode.setLeadSelection(i);
IPrivateTreeView.IVn_FolderContentNode folderContentNode = rootFolderContentElement.nodeVn_ChildNode();
IPrivateTreeView.IVn_FolderContentElement folderContentElement;
for(int j=0;j<wdContext.nodeVn_Entlmt().size();j++)
{
wdContext.nodeVn_Entlmt().setLeadSelection(j);
folderContentElement = folderContentNode.createVn_FolderContentElement();
folderContentElement.setText(wdContext.nodeVn_Entlmt().getVn_EntlmtElementAt(j).getVa_EntlmtDesc());
folderContentElement.setHasChildren(true);
folderContentElement.setIgnoreAction(true);
folderContentElement.setIsExpanded(true);
folderContentNode.addElement(folderContentElement);
IPrivateTreeView.IVn_FolderContentNode folderContentNode1 =folderContentElement.nodeVn_ChildNode();
IPrivateTreeView.IVn_FolderContentElement folderContentElement1;
for(int k=0;k<wdContext.nodeVn_Authcode().size();k++)
{
folderContentElement1 = folderContentNode1.createVn_FolderContentElement();
folderContentElement1.setText(wdContext.nodeVn_Authcode().getVn_AuthcodeElementAt(k).getVa_AuthcodeDesc());
folderContentElement1.setHasChildren(false);
folderContentElement1.setIgnoreAction(false);
folderContentElement1.setIsExpanded(false);
folderContentNode1.addElement(folderContentElement1);
}
}
}
}
Regards,
Sanyev
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ayyapparaj,
Actually one small issue I am facing when i click the child node of one parent the others also open. For ex.
my tree structure is as such: Role->entitlement->authcode
now if 1 instance authcode is clicked the action is processed meanwhile the 4th instance opens up i mean to say expands.
Thanks & Regards
Jaspreet Kaur Grewal
Context
TreeNode (node, 0:n)
- label (string)
- expandable (boolean)
- hasChildren (boolean)
- Children (recursive node -> TreeNode)
Code:
ITreeNodeElement addChildNode(ITreeNodeElement parent, String label, boolean hasChildren, boolean expandable)
{
ITreeNodeElement treeNode = parent.nodeChildren().createAndAddTreeNodeElement();
treeNode.setLabel(label);
treeNode.setHasChildren(hasChildren);
treeNode.setExpandable(expandable);
return treeNode;
}
/* place this into some controller method, but not into wdDoModifyView() */
/* invisible root, set Tree.rootVisible = false */
ITreeNodeElement root = wdContext.nodeTreeNode().createAndAddTreeNodeElement();
root.setHasChildren(true);
root.setExpandable(true);
ITreeNodeElement A = addChildNode(root, "A", true, true);
addChildNode(A, "a1", false, false);
addChildNode(A, "a2", false, false);
ITreeNodeElement B = addChildNode(root, "B", true, true);
addChildNode(B, "b1", false, false);
ITreeNodeElement C = addChildNode(root, "C", true, false);
addChildNode(C, "c1", false, false);
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Why are you loading the whole tree at once? Ideally you should load respective node children when they are expanded through the "onLoadChildren" event. Are you using recursive nodes in your context structure?
Regards,
Satyajit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.