1 Reply Latest reply on Mar 22, 2011 11:55 AM by k.urban

    process a4j:queue only after no more user input

    k.urban

      Hi,

      I am implementing a graphical user interface based on seam and richfaces for doing searches (and displaying search results).  Furthermore, the search application does contain functions to filter the search results.

      I want to implement the following behaviour: If one or more search filter is applied an action is automatically triggered to do a new search based on the applied filter. The action is only to be executed if the user did not apply any more filter within 2 seconds --> I want to prevent that there is a search request done based on incomplete filter settings. (It is not an option to add a separate button the user has to click on when he has finished with applying the filter.)

       

      Currently, whenever a single filter is applied (checkbox is ticked or unticked) an ajax request is created and put into the a4j:queue with similarityGroupingId attribute set. Furthermore I have added the requestDelay attribute to delay the processing of the first requestin the queue. But that does not solve my problem! I want the first request in the queue only to be processed when the user has been finished with applying all the filter.

      Do you know how to implement this behaviour?

       

      Below I have added an excerpt from one of the filter (here Language Filter: the user can filter for documents in different languages)

       

      <rich:treeNode>

           <a4j:outputPanel ajaxRendered="true">

                <h:selectBooleanCheckbox value="#{_language.selected}">

                     <a4j:support event="onclick" action="#{searchManager.filterQuery}"  eventsQueue="esQueue" reRender="resultDiv"

                                  requestDelay="2000" status="actionStatus" similarityGroupingId="languageFilter"/>

                </h:selectBooleanCheckbox>

                <h:outputText value="# {_language.displayName}"/>

            </a4j:outputPanel>

      </rich:treeNode>

       

      Furthermore I add the queue and status definition (I do not include the modal panel code)

       

       

      <a4j:queue name="esQueue" ignoreDupResponses="true"/>

      <a4j:status id="actionStatus" onstart="Richfaces.showModalPanel('mpActionStatus')"

                      onstop="Richfaces.hideModalPanel('mpActionStatus')" forceId="true"/>

       

      Thank you in advance, Konstanze

        • 1. Re: process a4j:queue only after no more user input
          k.urban

          Hi,

          I try to format the code snippets properly:

           

          {code:xml}

          <rich:treeNode>

               <a4j:outputPanel ajaxRendered="true">

                    <h:selectBooleanCheckbox value="#{_language.selected}" >

                         <a4j:support event="onclick" action="#{searchManager.filterQuery}"  eventsQueue="esQueue" reRender="resultDiv"

                                      requestDelay="2000" status="actionStatus" similarityGroupingId="languageFilter"/>

                    </h:selectBooleanCheckbox>

                    <h:outputText value="# {_language.displayName}" styleClass="#{_language.numOfResults > 0 ? 'facetValue-available' : 'facetValue-notAvailable'}"/>

               </a4j:outputPanel>

          </rich:treeNode>

           

           

          <a4j:queue name="esQueue" ignoreDupResponses="true"/>

          <a4j:status id="actionStatus" onstart="Richfaces.showModalPanel('mpActionStatus')"

                          onstop="Richfaces.hideModalPanel('mpActionStatus')" forceId="true"/>

          {code}