9 Replies Latest reply on Apr 10, 2007 1:05 PM by James Hays

    How to reRender a component self (reRender)?

    Lisa Mark Newbie

      Hi.,
      Could anyone please tell me is this possible?

      I have a checkbox default not selected, upon first select (boolean true), then rerender an other output field thru support tag with onclick event.

      The problem is I want to rerender the same checkbox component becos on first click it should be a checkbox but then (after click), it becomes a checked graphic image.

      <h:selectBooleanCheckbox
       rendered="#{! laufzettelBean.platzLogistikEntity.platzeingang}"
       value="#{laufzettelBean.platzLogistikEntity.platzeingang}"
       id="platzeinCheck">
       <ajax:support id="ajaxCheck" event="onclick"
       action="#{laufzettelBean.providerLogistikCheckbox}"
       reRender="platzeinCheck,checkedImage,datum" />
      </h:selectBooleanCheckbox>
      
      <h:graphicImage id="checkedImage"
       rendered="#{laufzettelBean.platzLogistikEntity.platzeingang}"
       value="#{designBean.defaultChecked}">
      </h:graphicImage>
      
      <h:outputText id="datum"
       value="#{laufzettelBean.platzLogistikEntity.platzEingangDatum}" />
      


      With above code I'm getting 'datum' output text updated on clicking checkbox but checkbox still exists (expected behaviour here is graphic image - on manual REFRESH F5, no more checkbox bt grahic image)

      So basically I want to rerender the parent component itself.

      Any ideas??

      Thanks

        • 1. Re: How to reRender a component self (reRender)?
          Sergey Smirnov Master

          Does laufzettelBean has a request scope ?

          • 2. Re: How to reRender a component self (reRender)?
            Lisa Mark Newbie

            Hi.,
            Thanks for ur reply.


            Does laufzettelBean has a request scope ?


            laufzettelBean is SESSION scoped Seam component.


            Thanks

            • 3. Re: How to reRender a component self (reRender)?
              Sergey Smirnov Master

              OK. This is an expected behavior. When rendered becomes false, the component rendering result is not included in the Ajax response and the DOM for this component is not updated after that.
              So, put <a4j:outputPanel id="foo"> and point to it with reRender. I.e. do not point to the component that might not be rendered

              • 4. Re: How to reRender a component self (reRender)?
                Prem Kosta Newbie

                Hi.,

                Thanks for ur tip.. its working now !!!!

                • 5. Re: How to reRender a component self (reRender)?
                  James Hays Novice

                  Can you post your code that you have working now? I'm having a similar issue and want to make sure I'm using the a4j:outputPanel correctly.

                  Thanks,

                  • 6. Re: How to reRender a component self (reRender)?
                    James Hays Novice

                    So, here's what I'm doing, maybe it's a bit different, but what I'm trying to do is reRender the parent element of the a4j:support.

                    Here's my code.

                    <h:panelGroup id="ProductList">
                     <a4j:repeat var="productRecord" value="#{profileGate.productRecords}">
                     <li id="product_#{productRecord.id}">
                     <h:panelGroup styleClass="removeProduct">
                     <a4j:support action="#{viewProfileRecord.requestProductRemoval(productRecord, profileGate)}"
                     ignoreDupResponses="true" event="onclick"
                     onsubmit="toggleStatusBar('Updating Product: #{productRecord.name}')"
                     oncomplete="toggleStatusBar('Complete', 2000)"
                     reRender="ProductList"/>
                     </h:panelGroup>
                     <s:link id="ProductLink" view="/productManagement.xhtml" propagation="nest"
                     title="#{productRecord.productTemplate.description}">
                     <h:outputText>#{productRecord.name} - #{productRecord.status.code}</h:outputText>
                     <f:param name="id" value="#{productRecord.id}"/>
                     </s:link>
                     </li>
                     </a4j:repeat>
                     </h:panelGroup>
                    


                    Here is what is dumped in the a4j log:

                    debug[16:40:08,486]: call getElementById for id= ProfileGates:_id65:ProductList
                    warn[16:40:08,486]: Node for replace by response with id ProfileGates:_id65:ProductList not found in document


                    If I reRender ProductList from a component outside of this iteration, it works fine and the entire list is regenerated. Am I missing something here?

                    I'm using RichFaces and Ajax4JSF snapshot from April 3.

                    • 7. Re: How to reRender a component self (reRender)?
                      Sergey Smirnov Master

                      So, <h:panelGroup id="ProductList"> has no id="ProfileGates:_id65:ProductList" in the result html. Can you can what the id is ?

                      • 8. Re: How to reRender a component self (reRender)?
                        James Hays Novice

                        I'm not quite sure what you are asking. I've run this with an <a4j:support tag outside of the <h:panelGroup id="ProductList"> and received this in the debug log.

                        debug[9:52:53,510]: Such element exist in document
                        debug[9:52:53,510]: Update page part from call parameter for ID ProfileGates:0:_id65:ProductList


                        So, it does exist. I just can't seem to use it if my a4j:supportTag is inside the reRendered panelGroup.

                        Here is what is rendered in xhtml:
                        <span id="ProfileGates:0:_id65:ProductList">
                        <li id="product_214">
                        <span class="removeProduct" onclick="toggleStatusBar('Updating Product: Final Quad Chart');A4J.AJAX.Submit('_viewRoot','ProfileGates:0:_id65',event,{'eventsQueue':'ProfileGates:0:_id65:_id67:0:_id70','parameters':{'ProfileGates:0:_id65:_id67:0:_id70':'ProfileGates:0:_id65:_id67:0:_id70'},'actionUrl':'/LCGM/viewLifecycle.seam','oncomplete':function(request,event,data){toggleStatusBar('Complete', 2000)},'ignoreDupResponses':true})"/>
                        <a id="ProfileGates:0:_id65:_id67:0:ProductLink" href="/LCGM/productManagement.seam?id=214&cid=17&clr=true&conversationPropagation=nest" title="The original Quad Chart, updated with the most current opportunity information. The Final Quad Chart ensures that additional information is captured.">Final Quad Chart - ppd</a>
                        </li>
                        <li id="product_215">
                        </li>
                        <li id="product_216">
                        <span class="removeProduct" onclick="toggleStatusBar('Updating Product: Bid/No Bid Critera Evaluation Form');A4J.AJAX.Submit('_viewRoot','ProfileGates:0:_id65',event,{'eventsQueue':'ProfileGates:0:_id65:_id67:2:_id70','parameters':{'ProfileGates:0:_id65:_id67:2:_id70':'ProfileGates:0:_id65:_id67:2:_id70'},'actionUrl':'/LCGM/viewLifecycle.seam','oncomplete':function(request,event,data){toggleStatusBar('Complete', 2000)},'ignoreDupResponses':true})"/>
                        <a id="ProfileGates:0:_id65:_id67:2:ProductLink" href="/LCGM/productManagement.seam?id=216&cid=17&clr=true&conversationPropagation=nest" title="Used to document intent at the Bid/No Bid Gate, summarize New Business efforts to date, and capture signature approval for Bid and Proposal funds.">Bid/No Bid Critera Evaluation Form - ppd</a>
                        </li>
                        <li id="product_308">
                        </li>
                        <li id="product_309">
                        </li>
                        <li id="product_310">
                        <span class="removeProduct" onclick="toggleStatusBar('Updating Product: James');A4J.AJAX.Submit('_viewRoot','ProfileGates:0:_id65',event,{'eventsQueue':'ProfileGates:0:_id65:_id67:5:_id70','parameters':{'ProfileGates:0:_id65:_id67:5:_id70':'ProfileGates:0:_id65:_id67:5:_id70'},'actionUrl':'/LCGM/viewLifecycle.seam','oncomplete':function(request,event,data){toggleStatusBar('Complete', 2000)},'ignoreDupResponses':true})"/>
                        <a id="ProfileGates:0:_id65:_id67:5:ProductLink" href="/LCGM/productManagement.seam?id=310&cid=17&clr=true&conversationPropagation=nest" title="">James - ppa</a>
                        </li>
                        </span>
                        


                        Does this help any?

                        • 9. Re: How to reRender a component self (reRender)?
                          James Hays Novice

                          I've updated to the latest Snapshots from April 10, for both Ajax4JSF and RichFaces and it now works.

                          Case Closed...