I need to create a tree structure in JSP which has parent child node relationship.Also this should expand and collapse/ Please advice how to create this.I am posting this is Javascript forum as on searching on internet I found that this can be done only throught javascript but I did not get any example on how to do it.
I got this working.Now I need this to be dynamic. My UI,LI elements to be dynamically creating the tree.E.g I want the user to be able to add the child or parent to the tree dynamically. Currenly in my tree parent and child are hardcoded.How to make that dynamic.
I need the user to be able to add parent and child dynamically.How to do that.Please advice.
thanks.
That depends upon how you are going let the user specify what is to happen. Once you know that, adding elements to the list elements is easy with jQuery.
1) User clicks on button Add parent-->A parent node is created to being the tree structure
2) User click on button Add child--> The child node is added to the parent node with parent child relation.(Tree control collapse,expand).
The tree control collapse expand is working fine for me. Now I am trying to build this on user clicks 1) and 2).
I know how to add a button, text or radioButton to fileds by adding an say to form and later using
(in case I need to add textbox dynamically.
But in my case I need to add UI and LI dynamically. If i replace text above with ui or li it doesnt work.
Please advice how to add these ui,li dynamically to build tree dynamically.