2 Replies Latest reply on Dec 6, 2011 7:44 AM by faupel

    dynamic panel group not re-rendered

    faupel

      Hi,

       

      I want to create a dynamic panel group each time a value in a combo box is selected, but the getter is not called when the component is re-rendered. I know that it works with the value attribute of an output text. Is there a way to re-render a value binding? Thank you in advance.

       

      Maximilian

       

       

       

      <rich:panel>
          <h:form id="dynamicPanelGroupForm">
              <h:selectOneMenu>
                  <f:selectItem itemValue="1" itemLabel="one" />
                  <f:selectItem itemValue="2" itemLabel="two" />
                  <a4j:support event="onchange" actionListener="#{dynamicPanelGroupBean.refreshPanelGroup()}" reRender="panelGroup" />
              </h:selectOneMenu>
           <h:panelGroup id="panelGroup" binding="#{dynamicPanelGroupBean.panelGroup}" />
          </h:form>
      </rich:panel>
      

       

      @AutoCreate
      @Scope(ScopeType.EVENT)
      @Name("dynamicPanelGroupBean")
      public class DynamicPanelGroupBean {
          private HtmlPanelGroup panelGroup;
      
          public void refreshPanelGroup() {
              FacesContext context = FacesContext.getCurrentInstance();
              panelGroup = (HtmlPanelGroup) context.getApplication().createComponent(
                      HtmlPanelGroup.COMPONENT_TYPE);
              HtmlEditor editor = (HtmlEditor) context.getApplication()
                      .createComponent(HtmlEditor.COMPONENT_TYPE);
              panelGroup.getChildren().add(editor);
          }
      
          public void setPanelGroup(HtmlPanelGroup panelGroup) {
              this.panelGroup = panelGroup;
          }
      
          public HtmlPanelGroup getPanelGroup() {
              return panelGroup;
          }
      }
      
        • 1. Re: dynamic panel group not re-rendered
          paul.dijou

          You can try to wrap the panelGroup in an outputPanel like :

           

          <a4j:outputPanel id="panelGroup">

              <h:panelGroup binding="#{dynamicPanelGroupBean.panelGroup}"/>

          </a4j:outputPanel>

           

          Not sure it will change anything but I don't know if the panelGroup is correctly initialize the first time since its a null value in your bean.

          • 2. Re: dynamic panel group not re-rendered
            faupel

            Hi Paul,

             

            the a4j:outputPanel did not change anything, but initializing the dynamic panel group in the constructor and a4j:support ajaxSingle="true" ... helped.

             

            Thanks for the hint.