I am trying to understand PrimeFaces' AjaxStatus indicator.
There are two facets - start and complete.
Can anybody tell me, what really determines start and complete.
I am just trying to make the indicator GIF image visible when user clicks a button and make it disappear when he click another button.
If whatever I am trying to achieve does not make any sense, an explanation would be really helpful.
Thanks.
ajaxStatus component works with globally set components. This means that a commandButton with the attribute:
global="true"
will trigger a process that will make use of ajaxStatus component (will update it's output).
This said, ajaxStatus start
facet will work when the listener method is called and will update when the complete
status is reached, this is, when the lifecycle of the call ends.
As I understand, this will not take care of the success or failure of the process. For this statuses, you also have other facets available: error
and success
.
<p:ajaxStatus>
<f:facet name="prestart">
<h:outputText value="Starting..." /> </f:facet>
<f:facet name="error"> <h:outputText value="Error" />
</f:facet>
<f:facet name="success"> <h:outputText value="Success" />
</f:facet>
<f:facet name="default"> <h:outputText value="Idle" />
</f:facet>
<f:facet name="start"> <h:outputText value="Please Wait" />
</f:facet>
<f:facet name="complete"> <h:outputText value="Done" />
</f:facet>
</p:ajaxStatus>
There is an ajax loading gif bundled with PrimeFaces:
<h:graphicImage library="primefaces" name="jquery/ui/ui-anim_basic_16x16.gif" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With