Having issue with Mapping Child-Parent in Tree [message #1723604] |
Tue, 16 February 2016 12:59  |
Eclipse User |
|
|
|
I am using below code but it is not displaying the correct mapping with child-parent in tree.
@Override
public void getPath(List path, Object element)
{
path.add(element); // Adding Parent here
List children = element.getChildren(); // getting all required child.
if (children != null && children.size() > 0)
{
for (Object child : children)
{
path.add(child); // Looping on loop for all child
}
}
}
-----------------------------------------------------------------------------------------------------------------------
In above code I get the one object which has three child but it is not showing with under correct parent.
-----------------------------------------------------------------------------------------------------------------------
For example, I have data that I want to show in tree format like , parent 'A' which has three child 'B', 'C', 'D'.
I am expecting result as below
A
----B
----C
----D
but I gets as below (not expected)
A
---- B
--------- C
-------------- D
What should I do more to get desired output.
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04837 seconds