1 Reply Latest reply on Apr 27, 2007 5:41 AM by niels-dee

    reRender not working using binding

    niels-dee

      I'm having some trouble re rendering a part of an outputPanel, i want to display some different form elements depending on the status of an order. I wrote the following code in my bean:

      @Stateless
      @Scope(ScopeType.EVENT)
      @Name("alertDetails")
      
      ..
       @Out(value="alertDetailsHtmlPanelGrid",scope=ScopeType.EVENT,required=false)
      private HtmlAjaxOutputPanel htmlPanelGrid = null;
      
       @Factory("alertDetailsHtmlPanelGrid")
       public void refresh(){
       log.info("Preparing");
       app = FacesContext.getCurrentInstance().getApplication();
       htmlPanelGrid = (HtmlAjaxOutputPanel) app.createComponent(HtmlAjaxOutputPanel.COMPONENT_TYPE);
      
       log.info("Generating HtmlPanelGrid using ows : "+orderWorkflowStatusId);
      
       HtmlOutputText text;
       text = (HtmlOutputText) app.createComponent(HtmlOutputText.COMPONENT_TYPE);
       text.setValue("You are looking at alert : "+orderWorkflowStatusId);
       htmlPanelGrid.getChildren().add(text);
      
       text = (HtmlOutputText) app.createComponent(HtmlOutputText.COMPONENT_TYPE);
       Random generator = new Random();
       text.setValue("Random value : "+generator.nextInt());
       htmlPanelGrid.getChildren().add(text);
      
       log.info("done building HtmlPanelGrid , no of children : "+htmlPanelGrid.getChildCount());
       }
      


      In my view i have commandButton which is in a rich treenode

      <a:commandLink reRender="alertDetailsPanel" value="#{item.description}">
      <f:param value="#{item.id}" name="orderWorkflowStatusId"/>
      </a:commandLink>
      


      The alertDetailsPanel is defined as :
      <a:outputPanel id="alertDetailsPanel" >
       <a:outputPanel binding="#{alertDetailsHtmlPanelGrid}"/>
       <br/>
       <h:outputText value="#{alertDetails.random}"/>
      </a:outputPanel>
      


      The jboss log tells me the refresh() method is called when i press the link.
      12:03:46,433 INFO [AlertDetailsBean] Preparing
      12:03:46,435 INFO [AlertDetailsBean] Generating HtmlPanelGrid using ows : 2288045
      12:03:46,435 INFO [AlertDetailsBean] done building HtmlPanelGrid , no of children : 2
      


      When i look at the a4j log i don't see any changes in the binding values, but the random value has changed.

      <span id="alertDetailsPanel"><span id="_id73">You are looking at alert : nullRandom value : 1334727162</span><br /> 196772874</span>
      



      The contents of the panel with the binding do not change, it does render when i load the page.

      Is this a bug or is there something i am doing wrong ?

        • 1. Re: reRender not working using binding
          niels-dee

          I still havent been able to fix this, i tried changing the binding to

          <h:form id="alertDetailsForm">
           <a:outputPanel binding="#{alertDetails.htmlPanelGrid}" />
           <br/>
           <h:outputText value="#{alertDetails.random}" />
          </h:form>
          


          This works, but i noticed the following

          11:38:16,672 INFO [AlertDetailsBean] setHtmlPanelGrid called
          11:38:17,479 INFO [AlertDetailsBean] Generating HtmlPanelGrid using ows : 2288481
          11:38:17,480 INFO [AlertDetailsBean] done building HtmlPanelGrid , no of children : 2
          


          The panelgrid gets set , but after updating the grid the getter isn't called.
          If i load the entire page i see :

          11:37:15,486 INFO [AlertDetailsBean] getHtmlPanelGrid called
          


          So the getter is only called when the page is rendered, not after a ajax request.

          Is this normal behavior ?