Page 1 of 2

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

Posted: 02 Jun 2011, 23:11
by penland365
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

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

Posted: 02 Jun 2011, 23:25
by tandraschko
Get the last nightly build

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

Posted: 27 Jun 2011, 17:55
by gersonj13
i have the same problem :shock: and i'm using primefaces-3.0-M2 :(

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

Posted: 27 Jun 2011, 17:58
by tandraschko
are you sure that u use 3.0-M2? (Please check your classpath)

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

Posted: 30 Jun 2011, 11:29
by Matrium
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>

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

Posted: 30 Jun 2011, 17:45
by jtrotman
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).

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

Posted: 30 Jun 2011, 17:48
by tandraschko
Are there really issues? The showcase seems to be fine.

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

Posted: 30 Jun 2011, 17:56
by jtrotman
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.

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

Posted: 30 Jun 2011, 18:44
by tandraschko
hmmm you could create an issue? Lazy loading nodes isn't in the showcase

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

Posted: 30 Jun 2011, 22:06
by jtrotman
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.