Question how to populate multi level marketing in the tree view?

kinki_2046

Member
Joined
Jun 8, 2011
Messages
23
Programming Experience
Beginner
Dear all,

I had to implement the multi level marketing tree node into the tree view.
Below is my example of the mysql table and the tree node:
tree.jpg

id username parent
1 james 0
2 steven 1
3 mark 1
4 jane 2
5 michael 4
6 david 2
7 john 4
8 lee 6
9 jason 4
10 calvin 3


Actually I also don't have any idea to populate the result for the them.

I need the tree view in 3 type:

a) view all the member in the tree view just at picture above
b) view the child only for a particular parent.
c) can specific how many level for the parent and child that will populate for a particular node.


Thanks for help.
 
The main thing you are probably missing is recursion, which is a function that will call itself to populate the treeview. You will also want to consider creating a People object which you could populate through queries ..SELECT ID,Name FROM...WHERE parent = x ...Then add to the treeview and pass recursively to perform the same actions on that child object, the end result will be your tree if you start with the root parent.
 
Back
Top