Click here to Skip to main content
15,908,909 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am creating a dynamic tree view. My requirement is to create a node and child node from a right click menu option. I created a custom menu with add node and add child node. Also i created a code to create a node when user right click and click node option. But i do not know how to create a child node. i mean my nodes do not have id. So when i click any node i need to create a child node. I have a properties of a node. My doubt doubt is how to insert these code to a user clicked node.

My tree code is

HTML
<div id="tree">

<ul id="browser" class="filetree treeview">
<ul id="upper">
    <li class="collapsable">
        <div class="hitarea collapsable-hitarea">
        </div>
        <span class="folder">Module1</span><ul>
            <li class="last">
                <div class="hitarea collapsable-hitarea">
                </div>
                <span class="folder">Group1.1</span>
                <ul>
                    <li class="collapsable">
                        <div class="hitarea collapsable-hitarea">
                        </div>
                        <span class="folder">Group1.2</span>
                        <ul>
                            <li class="last">
                                <div class="hitarea collapsable-hitarea">
                                </div>
                                <span class="file">Form1.1</span> 
                                </li>
                        </ul>
                    </li>
                    <li class="last">
                        <div class="hitarea collapsable-hitarea">
                        </div>
                        <span class="folder">Group1.2</span>
                        <ul>
                            <li class="last">
                                <div class="hitarea collapsable-hitarea">
                                </div>
                                <span class="file">Form2.1</span> </li>
                        </ul>
                    </li>
                </ul>
            </li>
        </ul>
    </li>
</ul>
</ul>



If i need to create a node Group1.3 under module1 when user click module1 dynamically using javascript. wats the solution. Can anyone help me please?
Posted
Comments
SP HINGU 29-Jan-14 7:04am    
bind Click event to class 'folder' and in that click event you can access that clicked node using 'this' , then just uppend your html to that node.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900