[richfaces-issues] [JBoss JIRA] (RF-13711) a4j:ajax status does not work as expected
Matej Novotny (JIRA)
issues at jboss.org
Thu Jul 10 08:51:27 EDT 2014
[ https://issues.jboss.org/browse/RF-13711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12983858#comment-12983858 ]
Matej Novotny edited comment on RF-13711 at 7/10/14 8:51 AM:
-------------------------------------------------------------
Alright I made a little bit of research on this because I found out we have this kind of usage in [Showcase|http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=status&sample=referencedUsage&skin=blueSky] and also we have similar use case in Metamer. So here are the results...
What matters is, whether you have {{status}} attribute set or not. I will use following code snippet to explain in better.
{code:xml}
<h:form>
<a4j:status id="progress" onstart="console.log('start')" onstop="console.log('stop')" />
<h:commandButton value="Click">
<a4j:ajax event="click" status="progress" /> <!-- not working -->
</h:commandButton>
<h:commandButton value="ClickMe2">
<a4j:ajax event="click" /> <!-- working -->
</h:commandButton>
</h:form>
{code}
The first button with attached ajax behavior has status set. This button *will not work*. This behaviour is IMHO a bug.
The other button, however, *will work*. (Too see why a4j:status affects components which do not specifically use status attribute see [documentation|http://docs.jboss.org/richfaces/latest_4_3_X/Component_Reference/en-US/html_single/#sect-Component_Reference-a4jstatus-Specifying_a_region]). This is a correct solution but with more complex page, a4j:status might react on more requests than intended. But still I think this can be considered a workaround until we investigate further.
Using a4j:commandButton instead of h:commandButton behaves equally.
NOTE: a4j:status with facets works correctly (for this we have Metamer [page|http://localhost:8080/metamer/faces/components/a4jStatus/referencedUsage.xhtml]), the problem is with onstart/onstop/onerror which should execute JS code
Also I made a mistake placing the reproducer in a4j:ajax instead of a4j:status, I will move and also alter the reproducer accordingly to my findings. I will update the issue information as well.
[~rustock0] you can try the workaround I suggested, it might fit your needs better.
was (Author: manovotn):
Alright I made a little bit of research on this because I found out we have this kind of usage in [Showcase|http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=status&sample=referencedUsage&skin=blueSky] and also we have similar use case in Metamer. So here are the results...
What matters is, whether you have {{status}} attribute set or not. I will use following code snippet to explain in better.
{code:xml}
<h:form>
<a4j:status id="progress" onstart="console.log('start')" onstop="console.log('stop')" />
<h:commandButton value="Click">
<a4j:ajax event="click" status="progress" /> <!-- not working -->
</h:commandButton>
<h:commandButton value="ClickMe2">
<a4j:ajax event="click" /> <!-- working -->
</h:commandButton>
</h:form>
{code}
The first button with attached ajax behavior has status set. This button *will not work*. This behaviour is IMHO a bug.
The other button, however, *will work*. (Too see why a4j:status affects components which do not specifically use status attribute see [documentation|http://docs.jboss.org/richfaces/latest_4_3_X/Component_Reference/en-US/html_single/#sect-Component_Reference-a4jstatus-Specifying_a_region]). This is a correct solution but with more complex page, a4j:status might react on more requests than intended. But still I think this can be considered a workaround until we investigate further.
Using a4j:commandButton instead of h:commandButton behaves equally.
Also I made a mistake placing the reproducer in a4j:ajax instead of a4j:status, I will move and also alter the reproducer accordingly to my findings. I will update the issue information as well.
[~rustock0] you can try the workaround I suggested, it might fit your needs better.
> a4j:ajax status does not work as expected
> -----------------------------------------
>
> Key: RF-13711
> URL: https://issues.jboss.org/browse/RF-13711
> Project: RichFaces
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: component-a4j-core
> Affects Versions: 4.3.7, 4.3.8
> Environment: IE8, Mozilla Firefox 30
> Reporter: Evgeny Mironenko
> Assignee: Matej Novotny
> Fix For: 4.5-Tracking
>
>
> Status attribute for {{a4j:ajax}} does not work as expected.
> I tried to create simple project with content:
> {code:title=index.xhtml}
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml"
> xmlns:h="http://java.sun.com/jsf/html"
> xmlns:a4j="http://richfaces.org/a4j">
> <h:head>
> </h:head>
> <h:body>
> <a4j:status id="progress" onstart="console.log('start')"
> onstop="console.log('stop')"/>
> <div id="content">
> <h:form>
> <h:commandButton value="Click">
> <a4j:ajax event="click" status="progress" listener="#{testBean.invoke}"/>
> </h:commandButton>
> </h:form>
> </div>
> </h:body>
> </html>
> {code}
> It did not work for me. I do not see any log messages in the console.
> As workaround I can use the {{render}} attribute instead of {{status}}, but we use it for another goals, am I right?
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
More information about the richfaces-issues
mailing list