3 Replies Latest reply on Nov 24, 2010 8:49 AM by renegritsch

    how to handle onclick and ondblclick event with a a4j:queue ?

    renegritsch

      can someone give me a correct example how to do this?

       

      i have 2 events registered and only one should be fired at a time. So click or dblclick..

      I played around with the queues but was unable to find a solution for this.

       

      maybe someone can give me an example?

       

       

      {code:xml}<a4j:queue name="treeClickQueue" size="1" sizeExceededBehavior="dropNext" requestDelay="150"/>

       

      <rich:tree eventsQueue="treeClickQueue" id="tree" switchType="ajax" ajaxSubmitSelection="true" ajaxSingle="true">

           <rich:recursiveTreeNodesAdaptor roots="#{tree.workspace}" var="item" nodes="#{item.children}">

                <rich:treeNode>

                     <h:outputText value="#{item.name}"/>

                     <a4j:support event="onclick"    action="#{test.test(1)}" immediate="true" ajaxSingle="true"/>

                     <a4j:support event="ondblclick" action="#{test.test(2)}" immediate="true" ajaxSingle="true"/>

                </rich:treeNode>

           </rich:recursiveTreeNodesAdaptor>

      </rich:tree>

      {code}

        • 1. Re: how to handle onclick and ondblclick event with a a4j:queue ?
          renegritsch

          Has no one an working example for me?


          How do you handle onclick and ondblclick ??

          • 2. Re: how to handle onclick and ondblclick event with a a4j:queue ?
            ilya_shaikovsky

            <a4j:queue requestDelay="300"></a4j:queue>
            <h:form>
            <a4j:outputPanel layout="block" style="width:100px; height:100px; border:1px solid black;" id="panel">
            <a4j:support event="onclick" immediate="true"
            ajaxSingle="true" similarityGroupingId="panel"/>
            <a4j:support event="ondblclick" similarityGroupingId="panel"
            immediate="true" ajaxSingle="true" />
            </a4j:outputPanel>
            </h:form>

                 <a4j:queue requestDelay="300"></a4j:queue>

                 <h:form>

                 <a4j:outputPanel layout="block" style="width:100px; height:100px; border:1px solid black;" id="panel">

                      <a4j:support event="onclick" immediate="true"

                           ajaxSingle="true" similarityGroupingId="panel"/>

                      <a4j:support event="ondblclick" similarityGroupingId="panel"

                           immediate="true" ajaxSingle="true" />

                 </a4j:outputPanel>

                 </h:form>

            pay attention:

            • requests marked as "similar" with special attribute. So them will be combined if came to queue sequentially
            • delay added in order the queue awaiting for similar requests for some time.
            • 3. Re: how to handle onclick and ondblclick event with a a4j:queue ?
              renegritsch

              Sorry doesn´t work for me, sometimes 2x/10

               

              onclick event
              onDBLclick event
              onclick event
              onclick event
              onclick event
              onDBLclick event
              onclick event

               

              Okay fixed it by

               

              {code:xml}<a4j:queue requestDelay="100" size="1" sizeExceededBehavior="dropNext"></a4j:queue>{code}