This project has moved and is read-only. For the latest updates, please go here.

Easiest way to create a treeview of folders and documents

Jan 26, 2012 at 1:59 PM

I've downloaded jsTree (a jquery plugin) and wants to show the content(folder and files) of a document library in a tree. Using the example at it is easy to get everything, but how to build a tree out of it? Will I have to parse ows_FileRef to figure out where a file belong or is there a smart way to do this?




Jan 26, 2012 at 6:35 PM

You would first need to figure out what format jstree expects to see. Then yes, you most likely would have to parse the results to that format.

Jan 26, 2012 at 7:30 PM

Also, it's good to note, the drag and drop "feature" of this library is busticated.  I looked at fixing it, but that codebase is complicated. :)  Let me clarify, the DnD does seems to work, but the callbacks that would be necessary to fire functions after dropping do not work.  In my case, I couldn't use this library b/c I couldn't update the items' position in the tree b/c the function would never fire.

If you were looking for a drag n drop tree structure, I'd suggest using Dojo for your tree structure, even though jstree looks better...



Jan 27, 2012 at 5:12 PM

I've got a client who is using EasyUI for trees. It uses some of the same CSS classes as SharePoint, so it can get a little messy, but it works.

Bottom line is, whichever tree plugin you decide to use, you'll need to figure out how to transform the SharePoint content into the format it wants (generally JSON or arrays).