2 Replies Latest reply on Jan 22, 2013 12:53 PM by Roberto Cordoba

    Unable to attach <a4j:ajax> to non-ClientBehaviorHolder parent (richfaces column)

    Roberto Cordoba Newbie

      Hi,

       

         I´m getting this error: "Unable to attach <a4j:ajax> to non-ClientBehaviorHolder parent" when I try to add a4j:ajax when onclick in a datatable column.

       

      Actually, if I do next, it doesn´t work:

      <rich:column styleClass="columna" id="paisColumna" label="#{msj.pais}"  >

                <a4j:ajax event="change" listener="#{I18nBean.setPais}" status="esperaStatus" render="panelBuscarCharter" />

      </rich:column>

       

      Bean:

      public void setPais(AjaxBehaviorEvent event) {

                          locale = new Locale("en");

                          FacesContext.getCurrentInstance().getViewRoot().setLocale(locale);

      }

       

       

      but if I do this (put the ajax call inside selectBooleanCheckBox in example, it works (with the same bean)  :

       

      <rich:column styleClass="columna" id="paisColumna" label="#{msj.pais}"  >

                                                                            <h:selectBooleanCheckbox id="mismoPuerto3" value="#{InicioBean.mismoPuerto}" class="perrisCheckbox">

                                                                                      <a4j:ajax event="change" listener="#{I18nBean.setPais}" status="esperaStatus" render="panelBuscarCharter" />

                                                                            </h:selectBooleanCheckbox>

                                                          </rich:column>

       

      I guess it is because rich:column doesn´t implement ClientBehaviourHolder interface. But then, how can I achieve this?

       

      I hope you can help me.

       

      Thanks in advance,

      Roberto.

        • 1. Re: Unable to attach <a4j:ajax> to non-ClientBehaviorHolder parent (richfaces column)
          Michal Petrov Master

          Hi,

          what exactly are you trying to do? From what I can see the column in question is empty (and there needs to be something the a4j:ajax could attach to), so what are you expecting to "change"?

           

          Can you show us the whole table and say what is it supposed to be doing?

          • 2. Re: Unable to attach <a4j:ajax> to non-ClientBehaviorHolder parent (richfaces column)
            Roberto Cordoba Newbie

            Hi Michal,

             

               thanks for your response.

             

            Actually, I made so many changes that finally I copied the bas example. What I want to do is the common functionality to support internationalization. I mean, when the user click on a language link, a popupPanel with a datatable of countries will be opened. The user will be able to click on a row (with a country). It´s suppose that an ajax action will be executed, so the language will change to the selected one by the user.

             

            I have read in another post that ajax click event in a rich:column is not working in richfaces 4. According to Ilya sugggestion, I have implemented with a "workaround" with jsFunction.

             

            Please find attached my complete popupPanel code:

             

            <rich:popupPanel id="popupPanelI18n" resizeable="false">

                 <f:facet name="controls">

                        <h:outputLink value="#" onclick="#{rich:component('popupPanelI18n')}.hide(); return false;">

                             <h:graphicImage value="/images/close.png" style="cursor:pointer" styleClass="hidelink" id="hideLinkPopupPanelI18n" />

                        </h:outputLink>                   

                 </f:facet>

             

                 <a4j:jsFunction name="selectRow" action="#{I18nBean.setPais}" render="panelBuscarCharter" oncomplete="#{rich:component('popupPanelI18n')}.hide(); return false;">

                        <a4j:param name="currentRow" assignTo="#{I18nBean.sLocale}"/>

                 </a4j:jsFunction>

             

             

            <div id="divI18n">

                 <h:outputText value="#{msj.pais}" />

                      <rich:dataTable id="PaisesTabla" value="#{I18nBean.internacionalizaciones}" var="i18n" onrowclick="selectRow('#{i18n.locale}');">

             

                           <f:facet name="header">

                                <h:outputText value="#{msj.pais}"/>

                           </f:facet>

             

                           <rich:column styleClass="columna" id="banderaColumna" label="#{msj.bandera}" >

                                <h:graphicImage value="/images/banderas/#{i18n.locale}.png" id="bandera" styleClass="imagenPequena" />

                            </rich:column>

                            <rich:column styleClass="columna" id="paisColumna" label="#{msj.pais}">

                                 <h:outputText value="#{i18n.pais}" />

                             </rich:column>

                       </rich:dataTable>

            </div>

            </rich:popupPanel>

             

            This is working.

             

            Is this a correct approach?

             

            Thanks,

            Roberto.