Using <p:ajax> inside of <p:tree> generates error

UI Components for JSF
penland365
Posts: 1
Joined: 02 Jun 2011, 23:04

02 Jun 2011, 23:11

Hello to all, I'm pretty much a newbie as jsf and primefaces, so I apologize if this is an often asked / often answered question. I'm trying to tie an event to select/deselect tree node. The code is available in the 3.0 labs showcase here: http://www.primefaces.org/showcase-labs ... Events.jsf.

I am attempting to recreate this, but the page fails to load with the following error:
/app/emailClient.xhtml @66,122 <p:ajax> Parent not an instance of ClientBehaviorHolder: org.primefaces.component.tree.Tree@44b717
The code is as follows:

Code: Select all

<p:tree value="#{emailCriteriaTreeBean.root}" var="node" id="checkboxTree" dynamic ="true" cache="false"
            selectionMode="checkbox" selection="#{emailCriteriaTreeBean.selectedNodes}" >
                                
                             
            <p:ajax event="select" update="selection" listener="#{emailCriteriaTreeBean.onNodeSelect}" />
            <p:ajax event="unselect" update="selection" listener="#{emailCriteriaTreeBean.onNodeDeselect}" />
                            
            <p:treeNode >
                  <h:outputText value="#{node}" />
            </p:treeNode>
</p:tree>
Unless i'm having a massive RTFM fail ( which is possible ), I don't see how this is different from the code listed on the showcase ( which is missing a closing " >" ). Can anyone help me out? I tried running this via a simple js and a hidden button, but its not giving me the full functionality I need.

Thanks in advance

Running:
Java: 1.6
GlassFish 3.1
Maven
Primefaces 3.0

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

02 Jun 2011, 23:25

Get the last nightly build
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

gersonj13
Posts: 1
Joined: 27 Jun 2011, 17:54

27 Jun 2011, 17:55

i have the same problem :shock: and i'm using primefaces-3.0-M2 :(

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

27 Jun 2011, 17:58

are you sure that u use 3.0-M2? (Please check your classpath)
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

Matrium
Posts: 112
Joined: 16 May 2011, 08:27

30 Jun 2011, 11:29

hi,

i have the same problem with 3.0.M2 (i am sure, because i double checked classpath + i get the log message "INFO: Running on PrimeFaces 3.0.M2-SNAPSHOT")

The error message is
<p:ajax> Parent not an instance of ClientBehaviorHolder: org.primefaces.component.tree.Tree@f0a3e8

Code: Select all

			<p:tree value="#{tree.root}" var="node"
						selectionMode="single" styleClass="template_tree">
						<p:ajax event="select" listener="#{navigation.onNodeSelect}" />
						<p:treeNode type="custom">
							<h:outputText value="#{node.bezeichnung}" />
						</p:treeNode>
					</p:tree>
PrimeFaces (Elite) 4.0.13, Majorra 2.1.28, Tomcat 7.0.53
Testing with Firefox, Chrome and IE9+IE10
<3 Primefaces!!!

jtrotman
Posts: 49
Joined: 29 Nov 2010, 14:32
Location: United Kingdom

30 Jun 2011, 17:45

As zoigl said - try using the latest nightly build.

However, there seem to be issues with p:ajax in the latest M2-SNAPSHOT, so it might be best sticking with M1 and using the old style listener configuration on your tree (using the nodeExpandListener/nodeCollapseListener/nodeSelecteListener attributes of p:tree rather than using the p:ajax tags).

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

30 Jun 2011, 17:48

Are there really issues? The showcase seems to be fine.
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

jtrotman
Posts: 49
Joined: 29 Nov 2010, 14:32
Location: United Kingdom

30 Jun 2011, 17:56

There certainly appear to be - today I upgraded from M1 to M2-SNAPSHOT for the application I'm working on, and ran into some fairly bizarre issues with the tree. Namely, that updating the tree from the p:ajax expand event tag causes the whole tree to disappear if processing occurs in the node expand listener method in the backing bean. I thought this was due to the tree model being reset or something similar, but debugging revealed that the tree was still populated, it just wasn't being displayed any more. As I need to lazily load child nodes from a database, it is imperative that I can update a displayed tree after a node is expanded. Consequently I've had to revert back to M1 for the time being.

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

30 Jun 2011, 18:44

hmmm you could create an issue? Lazy loading nodes isn't in the showcase
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

jtrotman
Posts: 49
Joined: 29 Nov 2010, 14:32
Location: United Kingdom

30 Jun 2011, 22:06

I'm using server side code to generate them in response to a node expand event, so while it is not a built in Primefaces feature, I think the best way of describing what I'm doing is lazy loading. I'm not sure if the tree disappearing issue is related to the fact that I'm creating new nodes on the fly - I'll investigate tomorrow and once I've got a good understanding of what triggers the problem I'll create an issue.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 19 guests