p:tree currupt after p:ajax exspand

UI Components for JSF
Post Reply
tobijdc
Posts: 2
Joined: 21 Aug 2014, 10:12

21 Aug 2014, 10:57

Dear Primefaces community,

I've been using Primefaces for months now and never had a big issue, but I haven't found a solution for this problem yet.

If i use p:ajax exspand update=@this or update=@form it corrupts my tree and only shows the Folders in the expanded Folder (See Images below).
If I use update=@none there is no issue.

Code: Select all

    <o:form id="navForm" includeViewParams="true" >
        <p:outputPanel id="navTreePan" style="width: 100%; height: 150px; overflow: auto; display: block;">
            <p:tree id="tree" var="node" value="#{afsFolderService.root}" style="width: 99%; min-height: 145px;">
                <p:treeNode type="all" expandedIcon="ui-icon-folder-open"
                            collapsedIcon="ui-icon-folder-collapsed">
                    <span style="cursor: pointer;"
                          onclick="this.parentNode.parentNode.firstChild.click();">
                        #{node.folderName}
                    </span>
                </p:treeNode>
                <p:treeNode type="afs-folder" expandedIcon="ui-icon-folder-open"
                            collapsedIcon="ui-icon-folder-collapsed">
                    <span style="cursor: pointer;"
                          onclick="this.parentNode.parentNode.firstChild.click();">
                        #{node}
                    </span>
                </p:treeNode>
                // More similar Types of TreeNode, which are currently unused
                <p:treeNode type="system" rendered="false" />
                <p:ajax event="expand" update="@form" process="@form" />
            </p:tree>
        </p:outputPanel>
    </o:form>

Image

After Click:
(The <span> still creates a 'pointer'-cursor, but clicking does not do anything
it just looks broken)
Image

After Reload:
Image

I want to use ajax to lazy load Elements from the Database with a listener in the Future.
(Because a certain Folderstructure is fixed, but the Elements below should be up to date, and it is best if they are only loaded when needed).

I would appreciate help ;)
PrimeFaces 5.0 | OmniFaces 1.8.1-20140603
Mojarra 2.2.7
Apache Tomcat 8.0.9 | Firefox 31
Fedora 20

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

21 Aug 2014, 12:37

Do not update @form on expand event because it also updates the tree.

Code: Select all

<p:ajax event="expand" update="@form" process="@form" />

tobijdc
Posts: 2
Joined: 21 Aug 2014, 10:12

21 Aug 2014, 12:42

Dear optimus.prime,

I want to update the Tree.
Because as stated in my original Question I want to use a Listener to add Nodes to the Tree (which needs an update of the tree).

Is this not possible the way I am trying to do it?

I know about the dynamic flag, but I would like to not have to build the whole Tree (in the bean) even tough just a small part is currently needed.
(Also I would like the entries to be fresh)
PrimeFaces 5.0 | OmniFaces 1.8.1-20140603
Mojarra 2.2.7
Apache Tomcat 8.0.9 | Firefox 31
Fedora 20

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

22 Aug 2014, 23:13

You can't update the tree on expand request, just add them at expand listener so that they will get displayed after expand completes. So basically try removing update attribute from your expand event since node being expanded is updated automatically.

LOGITRADE
Posts: 1
Joined: 27 Nov 2013, 17:53

15 Jan 2015, 13:15

May I add : Do not put the tree into an OutputPanel with autoUpdate="true" in order not the get the display broken.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 54 guests