Reputation: 21
I have a list of strings with are paths to some file with "/" separator that are available to my jsp/html page . i.e.
d1/d2/d3/file1.c
d1/d2/d3/file2.java
d1/d2/file3.jsp
d1/d2/file4.asp
d1/d2/d3/d4/file4.asp
d11/d22/d33/file5.txt
The above list of string paths are available to my page. I need to make a dynamic tree structre with above data in below tree structure using javascript.
+d1/d2/
file3.jsp
file4.asp
+d1/d2/d3/
file1.c
file2.java
+d1/d2/d3/d4/
file4.asp
+d11/d22/d33/
file5.txt
When I click on the common path like +di/d2 it should expand to show all the files under that directory , and when again click on it should hide the child files. Simmilarly for all other nodes.
Upvotes: 2
Views: 4390
Reputation: 1744
Since you have no code to show us, I'm not going to write it all for you. Just an overview, to tell you the method, you'll have to write your own code:
For reference: Javascript building tree hierarchy
Upvotes: 4