Question

I have the following code

<a4j:status id="commonstatus" onstart="#{rich:component('loading')}.show();" onstop="#{rich:component('loading')}.hide();" />
<rich:dataTable id="dTable" reRender="ds">
<rich:column id="name" filterMethod="#{myBean.filterName}">
...
<h:inputText> <a4j:support event="onkeyup" reRender="dTable, ds" ignoreDupResponses="true" requestDelay="700" oncomplete="setCaretToEnd(event);" /> </h:inputText>
...
<rich:datascroller id="ds" reRender="dTable">
...
<a4j:support event="onchange" reRender="dtable, ds" status="commonstatus" />
...
</rich:dataTable>

<rich:modalPanel id="loading" moveable="false" autosized="true">
<h:panelGrid columns="2">
        <h:graphicImage value="images/progress.gif"/>
        <h:outputText value="Loading..."/>
 </h:panelGrid>
 </rich:modalPanel>

Problem: Even if I have not specified status="commonstatus" in <h:inputText> I still get the loading image for onkeyup event. What am I missing here?

Any help would be great.

Was it helpful?

Solution

The <a4j:status> by default applies for all the components in the page that fire an ajax request. However, you can restrict the components that will be caught using the for attribute as stated in the tag component documentation:

for: ID of the AjaxContainer component whose status is indicated (in the format of a javax.faces.UIComopnent.findComponent() call).

OTHER TIPS

You can wrap h:inputText by an a4j:region

or

Set status attribute of the a4j:support to a not existing status id (e.g. status="none")

It's probably a little deprecated, but might be useful if anyone still works with Richfaces 3.3... I defined 2 status components in the common facelet template. One is the main status that is used across application whenever an ajax event fires and it applies to the whole page, and one is "none" status that does nothing (and it must be wrapped in region):

<a4j:status id="main" onstart="(something)" onstop="(something else)" />
<a4j:region>
   <a4j:status id="none" onstart="" onstop="" />
</a4j:region>

Whenever I don't want main status to appear, I specify "none" status as Andrey suggested, but the status component actually exists so the warning about non-existing component is avoided.

Don't forget to wrap it in a4j:region, or it won't work correctly - if you have 2 status components in the same region, I think that always the second one will be used, no matter what you put in status tag of your component which fires the request...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top