Cancellation of Ajax Request in RichFaces

I have issue with canceling Ajax Request. Our application interface is build in RF.

On the progress bar modal there should be cancel button - that interupt current operation, for example cancel filling controls from database. How to make it?

I tried using reloading page, flags with "if" conditions on getters for controls and also using "bypassUpdates" with no positive effects.

Thanks in advance for your help

XHTML (Button):

<a4j:commandButton id="showData"
          value="View" styleClass="hBtn"
          oncomplete="if (#{facesContext.maximumSeverity==null}) 

JAVA: (Button):

public void actionShow(ActionEvent evt) {
    //Some logic, getting data from database


XHTML (Main Page - showing wait Popup)

    <a4j:status id="ajaxStat"
        onstop="#{rich:component('waitPanel')}.hide()" />

XHTML (Popup):

<rich:modalPanel id="waitPanel" autosized="true" moveable="false"
         minWidth="250" styleClass="popup">
    <f:facet name="header">
        <h:outputText value="Operation in progress"></h:outputText>
    <f:facet name="controls">
        <h:graphicImage value="../images/icons/action_close.gif" styleClass="hidelink" id="hidelink"/>
        <rich:componentControl for="waitPanel" attachTo="hidelink" operation="hide" event="onclick"/>
    <a4j:form id="msgFrm" ajaxSubmit="true">
    <h:outputText value="Please wait..."/>
    <h:graphicImage styleClass="progressBar" value="../images/indicatorbar.gif"/>
        <a4j:commandButton value="Cancel" type="button"

JAVA (Popup):

public void cancelAction(){
//there was setter for true/false flag for actionShow() here, now there is nothing here (it was not working)


Reloading the page stops all current ajax requests. It does not stop the java backing beans from finishing the requests but I assume that is not the question. c:if and the ajax render do not mix very well. Possibly you could use 'rendered' to disable updating the controls? Then split the control in two parts. One is shown with valid data and for example bright blue. The other is rendered without any data and has a grey picture.

But... I'm not sure I understand the question correctly.

Edit 23-1-2012: Seeing the code I would say that the cancelAction must set a flag that then finishes the action running inside actionShow(). Then the ajax request finishes and the popup is closed. Can't see why this won't work.

Need Your Help

ActionBarSherlock: How to bypass the Holo Theme for 4.x devices?

android android-layout actionbarsherlock android-theme

I am trying to bypass the Holo theme for 4.x devices (such that the app looks the same on all versions 2.x to 4.x). I have tried this by changing the theme.xml from values-14/ folder with the ones ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.