简体   繁体   中英

Call rich:modalPanel for every ajax request with out using a4j:status?

I am developing web application using JSF richfaces.I have one rich:modalpanel in main templete. This modalPanel have 'Your request is processing....." message.

I want to show this message( modalPanel ) every action( ajax request ). But without using a4j:status element.

Is there possible to acheive this(using listener or any otherway)?
How to show the wait modalPanel for all action using listener ?

Help me about this. Thanks in advance.

Update :

If i use my main templete,

<a4j:status id="waittingMessage"
            onstart="javascript:Richfaces.showModalPanel('progressWaitModalPanel');"
            onstop="javascript:Richfaces.hideModalPanel('progressWaitModalPanel');"/>       

And i call the above a4j:status for the following places : The following each and every component i use more than 100 place in my application

            <a4j:commandButton status="waittingMessage"/> 
            <a4j:commandLink   status="waittingMessage"/> 
<h:selectOneMenu><a4j:support  status="waittingMessage"/>  </h:selectOneMenu>
<h:selectOneRadio><a4j:support status="waittingmessage"/></h:selectOneRadio>
<h:selectBooleanCheckbox><a4j:support status="waittingmessage"/></h:selectBooleanCheckbox>

In future,

i don't need to show the progressWaitModalPanel , that time i will delete a4j:status in main templete.
But what about this status="waittingMessage" ? Because this status="waittingmessage" i added more than 1000 places in my whole application.

<a4j:status> is the proper way to do this. I don't know of any other way. Perhaps you can hook to some low-level javascript, but that would be the wrong thing to do.

If the status is in the current form , there is no need to explicitly indicate which is the status - it is used by default.

<a4j:status id="waittingMessage"
        onstart="Richfaces.showModalPanel('id_modalPanel')"
        onstop="Richfaces.hideModalPanel('id_modalPanel')">
        <f:facet name="start">
            <label></label>
        </f:facet>
        <f:facet name="stop">
            <label></label>
        </f:facet>
</a4j:status>
<ui:include src="/modalPanel.xhtml" />

modalPanel.xhtml can contain display related content.

you can put the content above in a separate file say status.xhtml and then include it in your other pages as below:

<a4j:outputPanel ajaxRendered="true">
<ui:include src="status.xhtml" />
</a4j:outputPanel>

so any page that has ajax request will display above message window You need not add any status msg for each a4j:button ,etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM