What is the best way to create a SharePoint tree view web part for a document library?
It is also possible to get the treeview with clientsidecode
Something like this
var context = SP.ClientContext.get_current();
var list = context.get_web().get_lists().getByTitle(listTitle);
context.load(list,'Include(RootFolder)');
context.executeQueryAsync(function () {
createRoot(list);
},
function (sender, args) {
console.log('error');
});
then you have to make a createRoot function that inserts the html from the library tree when the user clicks. That depends that the tree is not expanded by default.
Elena,
If you are looking for Out of the box way, you can use Grouping to achieve some level of Tree view..
But if you want folder wise structure as a complete Tree-view till n-levels, there is no Out of the box feature available. You will need to create a custom Web Part, already shown here:
Document Library Tree View Web Part for SharePoint
Or
Add a Treeview to a Document LIbrary using SPTreeView and SPHierarchicalDataSource