N
N
njanma2016-01-16 12:56:08
JavaScript
njanma, 2016-01-16 12:56:08

How to build a folder tree?

I want to build a tree from the file system from www.ztree.me/v3/api.php. Tell me how to organize this in spring mvc.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evhen, 2016-01-16
@njanma

You need to write a controller that takes a path in the file system as a parameter, for example:
D:/
D:/Music/
D:/Music/Classic/
etc.
In the controller, you get a list of subdirectories and files along this path and return it as json. As in the zTree examples:

[
  {name: "pNode 01", children: [
    {name: "child 01"},
    {name: "child 02"}
  ]}
]

By default, only the root node D:/ is displayed on the page. By
clicking on the node, you ajax send a request to the controller in which you pass D:/, the controller returns a list of subdirectories, you pass this to zTree, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question