2 Replies Latest reply on Dec 21, 2010 4:08 AM by flavioeasy

    limit ajax request

    flavioeasy

      Hi all,

      i have a dataTable with a checkBox on each row and i have ajaxed, with <a4j:support>,  the "onclick" event on the checkBox cause i 've to do some stuff when the user checks the row.

      On the whole dataTable i have another <a4j:support> that gets the "onRowClick" event to do other work when the user selects the row.

      My problem is that when user checks the checkBox both events are fired.

      I 'd like to limit the event only to that component.

      Can somebody help me ?

      Any hint would be appreciated.

      Flavio

       

      here is the relevant code :

       

      <rich:dataTable value="#{esMan4cc.controller4GuiExt}"

                                              var="itemx"

                                              id="ESListExt"

                                              rows="50" rendered="#{esMan4cc.controller4GuiExt.dataFound}" >

                                  <f:facet name="header">

                                      <rich:datascroller id="ESTableDataScrollerExt"

                                                         maxPages="10"

                                                         for="ESListExt"

                                                         renderIfSinglePage="false"

                                                         ajaxSingle="true"/>

                                  </f:facet>

                                  <a4j:support event="onRowClick" reRender="ESListExt"

                                               actionListener="#{esMan4cc.rowFileSelectedExt}" >

                                      <f:setPropertyActionListener value="#{itemx.ESMovExtPK}" target="#{esMan4cc.selRowExt}" />

                                  </a4j:support>

                                  <rich:column sortable="false" id="sele_colx" >

                                      <f:facet name="header">

                                          <h:outputText value="#{mess.labelSel}" id="sele_heax"/>

                                      </f:facet>

                                      <h:selectBooleanCheckbox value="#{esMan4cc.rowSelectedExt}" id="sele_fldx" >

                                          <a4j:support event="onclick" reRender="ESSelValExt"

                                                       actionListener="#{esMan4cc.rowFileSelectedExt}" >

                                              <f:setPropertyActionListener value="#{itemx.ESMovExtPK}" target="#{esMan4cc.curRowExt}" />

                                          </a4j:support>

                                      </h:selectBooleanCheckbox>

                                  </rich:column>

                                  <rich:column sortable="false" id="m1valu_col" >

                                      <f:facet name="header">

                                          <h:outputText value="#{mess.labelValueDate}" id="m1valu_hea"/>

                                      </f:facet>

                                      <h:outputText value="#{itemx.m1valu}" id="m1valu_fld" title="#{itemx.m1desc}" styleClass="#{esMan4cc.styleExt}" >

                                          <f:convertDateTime pattern="dd-MM-yyyy" timeZone="#{esMan4cc.defaultTimeZone}"/>

                                      </h:outputText>

                                  </rich:column>

                                  <rich:column sortable="false" id="m1oper_col">

                                      <f:facet name="header">

                                          <h:outputText value="#{mess.labelBookDate}" id="m1oper_hea"/>

                                      </f:facet>

                                      <h:outputText value="#{itemx.m1oper}" id="m1oper_fld" title="#{itemx.m1desc}">

                                          <f:convertDateTime pattern="dd-MM-yyyy" timeZone="#{esMan4cc.defaultTimeZone}"/>

                                      </h:outputText>

                                  </rich:column>

                                  <rich:column sortable="false" id="m1imdo_col" styleClass="text-to-right">

                                      <f:facet name="header">

                                          <h:outputText value="#{mess.labelCtv}" id="m1imdo_hea"/>

                                      </f:facet>

                                      <h:outputText value="#{itemx.m1imdo}" id="m1imdo_fld" title="#{itemx.m1desc}">

                                          <f:convertNumber pattern="#,##0.00"/>

                                      </h:outputText>

                                  </rich:column>

                                  <rich:column sortable="false" id="m1sign_col">

                                      <f:facet name="header">

                                          <h:outputText value="#{mess.labelSign}" id="m1sign_hea" title="#{itemx.m0desc}"/>

                                      </f:facet>

                                      <h:outputText value="#{itemx.m1sign}" id="m1sign_fld"/>

                                  </rich:column>

                                  <rich:column sortable="false" id="m1key_col">

                                      <f:facet name="header">

                                          <h:outputText value="#{mess.labelIdMov}" id="m1key_hea"/>

                                      </f:facet>

                                      <h:outputText value="#{itemx.ESMovExtPK}" id="m1key_fld" title="#{itemx.ESMovExtPK}"/>

                                  </rich:column>

                              </rich:dataTable>

        • 1. Re: limit ajax request
          nbelaevski

          Hi Flavio,

           

          Try doing this:

           

          <a4j:outputPanel onclick="if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; }">
          <h:selectBooleanCheckbox />
          </a4j:outputPanel>

          <a4j:outputPanel onclick="if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; }">

          <h:selectBooleanCheckbox />

          </a4j:outputPanel>

          • 2. Re: limit ajax request
            flavioeasy

            Hi Nick,

            it works perfectly for me ;-))

            Thanks a lot

            Flavio