-
1. Re: <rich:treeNode> ignoring <f:ajax> or <a4j:ajax>
iabughosh Mar 21, 2012 3:01 AM (in response to wesley_menezes)Welcome to the community Wesley,
i think the problem is in your listener method signature, ajax listener signature should be like this:
public void processTreeSelectionChange(AjaxBehaviorEvent abe) {
//do your action here
}
regards.
-
2. Re: <rich:treeNode> ignoring <f:ajax> or <a4j:ajax>
wesley_menezes Mar 21, 2012 11:51 PM (in response to iabughosh)Ibrahim,
thanks for your answer. I tried your suggestion, but no sucess.
Then I tried changing the <f:ajax> for <a4j:ajax> and again no sucess. But with <a4j:ajax> the tree blocked the tree expanding (actually, when I click to expand, the tree expand and contract very fast! What a strange behavior...).
I look in RichFaces showcase something similar to your suggestion, but with <rich:extendedDataTable>.
So, my impression is that maybe a problem with "treenode"...
I checked app server log and httpfox messages, but no clues. By the way, in httpfox, I see that when "mousedown" occurs it creates a post request whit result 200 (ok!), but no method call on server!
Tks again!
-
3. Re: <rich:treeNode> ignoring <f:ajax> or <a4j:ajax>
sunkaram Mar 22, 2012 4:01 PM (in response to wesley_menezes)are you still using : listener="#{customerBean.processTreeSelectionChange(node.data)}"
or changed it to : listener="#{customerBean.processTreeSelectionChange}"
-
4. Re: <rich:treeNode> ignoring <f:ajax> or <a4j:ajax>
wesley_menezes Mar 22, 2012 10:38 PM (in response to sunkaram)Hi Maheswara,
Actually I need to use the new form, passing arguments:
listener="#{customerBean.processTreeSelectionChange(node.data)}"
But trying to understand what was the problem I tried method with no arguments.
Both ways the result was the same, no sucess, no method call for <rich:treeNode>.
Thank you
-
5. Re: <rich:treeNode> ignoring <f:ajax> or <a4j:ajax>
pdhung3012 Mar 22, 2012 11:33 PM (in response to wesley_menezes)Hello Mendes.
I have the same problem with you too.
I understand why you create that method. I think because the treeSelectionChangeEvent in rich:tree not show exactly as this demo, so you have to give data directly when click rich:treeNode.
I've tried this code in this demo (http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=tree&skin=blueSky), but the treeSelectionChangeListener doesn't active, so desperate.
http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=tree&skin=blueSky
<
rich:tree
id
=
"tree"
nodeType
=
"#{node.type}"
var
=
"node"
value
=
"#{treeBean.rootNodes}"
toggleType
=
"client"
selectionType
=
"ajax"
selectionChangeListener
=
"#{treeBean.selectionChanged}"
>
<
rich:treeNode
type
=
"country"
>
#{node.name}
</
rich:treeNode
>
<
rich:treeNode
type
=
"company"
icon
=
"/images/tree/disc.gif"
>
#{node.name}
</
rich:treeNode
>
<
rich:treeNode
type
=
"cd"
icon
=
"/images/tree/song.gif"
>
#{node.artist} - #{node.name} - #{node.year}
</
rich:treeNode
>
If you have free time, please check my test case project in my wordpress: http://phandanghung.wordpress.com/2012/03/22/welcome-to-my-jsf-tutorial-project/. Please check test case 3 to view our problem
Sincerely thanks.
-
6. Re: <rich:treeNode> ignoring <f:ajax> or <a4j:ajax>
wesley_menezes Mar 23, 2012 12:13 AM (in response to pdhung3012)Hello Hung,
I will test your sample, just give me some time, but I will test...
Mean time, to my problem, I could do something right now that will gave same efffect (events on treeNode), but the solution is not so elegant, look:
First in XHTML:
<rich:treeNode ... onmousedown="processTreeSelectionChange(#{node.data.id})"/>
Second still XHTML:
<a4j:jsFunction name="processTreeSelectionChange" action="#{memoriaLaudoTreeCreatorBean.processTreeSelectionChange}">
<a4j:param name="node" assignTo="#{memoriaLaudoTreeCreatorBean.elementoSelecionadoId}"/>
</a4j:jsFunction>
Third CDI Bean:
...
private String elementoSelecionadoId;
...
//getter and setter
...
public void processTreeSelectionChange ( ) {
//recover original node from the elementoSelecionadoId (searching in rootNodes)
}
Well, this will help me for a while, but I would like to use the new form of calling methods with arguments, present in JSF 2.2.
Still, I opened a bug report in RichFaces 4.2.0 Final Jira, if I have some answer from there I will post here that answer.
Best Regards
Wesley Menezes
-
7. Re: <rich:treeNode> ignoring <f:ajax> or <a4j:ajax>
pdhung3012 Mar 24, 2012 2:33 PM (in response to wesley_menezes)Thank you Wesley Meneles.
I've tried to code like you, but unfortunately, the treeSelectionChange event doesn;t work. My code like this
Header 1 <rich:tree id="tree" nodeType="#{node.type}" var="ajax" value="#{testCase4Bean.rootNodes}" toggleType="client"
selectionType="ajax">
<rich:treeNode type="country" onclick="processTreeSelectionChange(#{node.name})">
#{node.name}
</rich:treeNode>
</rich:tree>
And js like this
<a4j:jsFunction name="processTreeSelectionChange" action="#{testCase4Bean.processTreeSelectionChange()}">
<a4j:param name="node" assignTo="#{testCase4Bean.myNodeData}"/>
</a4j:jsFunction>
likes many times. I feel so bad .
-
8. Re: <rich:treeNode> ignoring <f:ajax> or <a4j:ajax>
pdhung3012 Mar 25, 2012 1:59 PM (in response to pdhung3012)Finally I've done this function successfully . I have to change like this:
Header 1 <rich:tree id="tree" nodeType="#{node.type}" var="node" value="#{testCase4Bean.rootNodes}" toggleType="client"
selectionType="ajax" >
<rich:treeNode type="country">
<a4j:ajax event="click" oncomplete="processTreeSelectionChange('#{node.name}')"/>
#{node.name}
</rich:treeNode>
</rich:tree>
....
<a4j:jsFunction name="processTreeSelectionChange" render="showname">
<a4j:param name="name" assignTo="#{testCase4Bean.myNodeData}" />
</a4j:jsFunction>
And it success. I think this is a bug that developers can change in the 4.3.0 release