开发者

how does PrimeFaces' AjaxStatus work?

I am trying to understand PrimeFaces' AjaxStatus indicator.

Ther开发者_C百科e 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" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜