1

Is it possible to download files from a server using jstree as a directory viewer?

Note - I have created a jstree by connecting to my Dropbox account and populating the tree from the json results sent via Dropbox.

So I can see the contents of my Dropbox account, that is fine, however I would like to interact with the nodes, (download, delete, upload, etc.)

Is this feasible?

  • I use jsTree for the same purpose. Only within our LAN though. Have download, delete buttons and use checkboxes to identify what file the operation is going be done on. – Radek Apr 16 '13 at 23:39

2 Answers2

1

As long as you can get the data (like from Dropbox), yes, it's entirely possible. Essentially, jsTree is just a way to represent data. It's not bound to any certain type of data. If you have a bunch of data from Dropbox that represents a file system in some way, you can represent that data however you like, including using jsTree.

GJK
  • 37,023
  • 8
  • 55
  • 74
0

This is possible via the select_node event. See the jsTree UI plugin documentation

.select_node ( node , check , event )
  • node (mixed)
    This can be a DOM node, jQuery node or selector pointing to an element within the tree.
  • check (bool)
    Whether to check the specified rules and do appropriate actions (check select_limit, deselect other nodes respectively, etc) or to just force selection of the node regardless of select_limit.
  • event (event)
    Used internally - when a click on a node caused this function to be executed.

It can be tricky to pass data around depending on how much metadata is needed for your callbacks. In this case jsTree has support for metadata per node using jQuery data plugin. This SO article talks about using metadata in jsTree.

Community
  • 1
  • 1
stuisme
  • 389
  • 1
  • 6