2 Replies Latest reply on Nov 2, 2011 4:33 AM by Adrien Adrien

    [RF4.1.M3] Bug? render="ids" different behaviour between a4j:commandButton  or h:commandButton with f:ajax

    Adrien Adrien Apprentice

      Hi

       

      The sample code below show two buttons: 1 a4j:commandButton and 1 h:commandButton using f:ajax.

       

      The two buttons have the same render attribute so we expect there will have the same 'behaviour' components.

      In fact, no,  if there is a component like for exemple a4j:outputPanel with ajaxRendered="true" then a4j:commandButton will refresh outputPanel but not the h:button with f:ajax.

       

      So my question is : is this difference normal ?

      Thanks

       

      {code:xml}<a4j:outputPanel id="panelajaxtrue1" ajaxRendered="true"> </a4j:outputPanel>

                           <a4j:outputPanel id="panelajaxfalse2" ajaxRendered="false">ccccc </a4j:outputPanel>

       

                           <h:form>

                                         <a4j:outputPanel id="panelajaxtrue2" ajaxRendered="true">ccccc </a4j:outputPanel>           

                                         <a4j:outputPanel id="panelajaxfalse2" ajaxRendered="false">ccccc </a4j:outputPanel>

       

       

      <rich:dataGrid  id="datas" value="#{ctrlCompareAJCommandAndAjax.datas}" var="data" columns="1" >

      <h:outputText value="#{data}" />

      </rich:dataGrid>

       

                                         <a4j:commandButton value="delete a4j" action="#{ctrlCompareAJCommandAndAjax.delete}" execute="datas" render="datas"/>

       

                                        <h:commandButton value="delete ajax" action="#{ctrlCompareAJCommandAndAjax.delete}" >

                                                                   <f:ajax execute="datas" render="datas" />

                                          </h:commandButton>

                             </h:form>

                           <a4j:log />

      {code}

        • 1. Re: [RF4.1.M3] render="ids" different behaviour between a4j:commandButton  or h:commandButton with f:ajax
          Adrien Adrien Apprentice

          I think it s a bad behaviour of richfaces, if we have a component like rich:toogle or tabpanel then it can  cause error@malformedXML.

          The sample below log a "error@malformedXML" at the first ajax request for example when you click on "delete a4j".

           

          So it works fine if you click on "delete f:ajax"

           

          What do you thinks about that?

           

          Best regards.

           

          error[21:44:00.967]: Received 'error@malformedXML' event from <input id=j_idt4:j_idt11 ...>

          error[21:44:00.968]: [200] undefined: undefined

           

           

          {code:xml}<h:form>

            <rich:togglePanel value="closed" switchType="ajax" activeItem="closed">

                <rich:togglePanelItem id="closed" >

                <h:panelGroup id="i3" layout="block">     

                       <h:commandLink  value="[more]" >

                        <rich:toggleControl   targetItem="tip1" />

                       </h:commandLink>

                       </h:panelGroup>

                </rich:togglePanelItem>

               <rich:togglePanelItem id="tip1">   

                <rich:panel>

                <f:facet name="header">       

                   <h:commandLink  value="[close]" >

                        <rich:toggleControl   targetItem="closed" />

                       </h:commandLink>

                       </f:facet>

                       <a4j:outputPanel id="panelajaxtrue1" ajaxRendered="true">

                        <h:outputText rendered="#{not empty ctrlCompareAJCommandAndAjax.selected}" value="#{ctrlCompareAJCommandAndAjax.inc}" />

            </a4j:outputPanel>

                  </rich:panel>

               </rich:togglePanelItem>  

                </rich:togglePanel>             

           

            <rich:dataGrid   id="datas" value="#{ctrlCompareAJCommandAndAjax.datas}" var="data" columns="1" >

            <h:outputText value="#{data}" />

            </rich:dataGrid>

            <a4j:commandButton value="delete a4j" action="#{ctrlCompareAJCommandAndAjax.delete}" execute="datas" render="datas">

            </a4j:commandButton>

            <h:commandButton value="delete f:ajax" action="#{ctrlCompareAJCommandAndAjax.delete}">

            <f:ajax execute="datas" render="datas" />

            </h:commandButton>

           

            </h:form>

            <a4j:log />

          {code}

          • 2. Re: [RF4.1.M3] render="ids" different behaviour between a4j:commandButton  or h:commandButton with f:ajax
            Adrien Adrien Apprentice

            By adding limitRender="true" to a4j:commandButton it  works like f:ajax

             

            <a4j:commandButton limitRender="true"  value="delete a4j" action="#{ctrlCompareAJCommandAndAjax.delete}" execute="datas" render="datas">
              </a4j:commandButton>

             

            Regards