Carlos Junior
Carlos Junior

Reputation: 3

Creating a Folder System in a p:tree

I need select a folder and list its files.

But I can't give the user, access to the fileSystem, so I need to list the subfolders from a specific path (/u01/SNV).

I'm trying to use a <p:tree> for that. But I can't seem to manage populating the tree. (I've been looking on Google for a couple of days now)

That's the code I have for the tree:

<p:commandButton value="Load"
                 action="#{treeBasicView.LoadTreeBean}" 
                 update="TreeBean"
                 immediate="true"/>     


<p:tree value="#{treeBasicView.root}" id="TreeBean" var="node" dynamic="true">
    <p:treeNode>
        <h:outputText value="#{node}"/>
    </p:treeNode>
</p:tree>

[UPDATED] I need is the routine to look in the Hard Drive for the folders and create the nodes based on those folders. I don't have specific folders. I need to read them dynamically.[/UPDATED]

Thank you all in advance.

Upvotes: 0

Views: 1482

Answers (1)

giaffa86
giaffa86

Reputation: 729

Take a look to primefaces showcase. This seems that you want: http://www.primefaces.org/showcase/ui/data/tree/icon.xhtml

The part about manage populating is delegated to DocumentService.java.

Of course, you can also manipulated data model after render phase.

Upvotes: 1

Related Questions