1 Reply Latest reply on Jul 11, 2010 10:31 PM by Akaine Harga

    Clicking while reRender gives NoSuchUIElement

    Steven De Groote Newbie

      Hi,

       

      I find that when you click a certain element which is about to rerender you can sometimes get a NoSuchElementException.

       

       

                   <a4j:queue id="queue"/>
                      <table>
                          <tr>
                              <td>
                                  <h:selectOneListbox size="1" rendered="#{quoteVehicle.number_of_templates > 3}" id="qtemplate" value="#{quoteVehicle.QTemplateId}" valueChangeListener="#{quoteVehicle.changeQTemplateSelect}">
                                      <a4j:support event="onchange" eventsQueue="queue" reRender="filtermessage,fueltypetable,energylabeltable,maketable,bodystyletable,modeltable,typetable,carpic" ajaxSingle="true" />
                                      <f:selectItems value="#{quoteVehicle.QTemplateItems}"/>
                                  </h:selectOneListbox>
                              </td>
                          </tr>
                      </table>
                      <t:div id="maketable">
                          <table>
                              <tr height="20">
                                  <td>
                                      <t:div id="filtermessage_template">
                                          <h:outputText styleClass="message" value="#{msg.vehicle_select_template}" rendered="#{!quoteVehicle.templateSelected}" />
                                      </t:div>
                                      <h:panelGrid columns="2" cellpadding="0" cellspacing="0">
                                          <h:panelGroup>
                                              <t:selectOneRadio layout="spread" id="make" rendered="#{quoteVehicle.templateSelected}" value="#{quoteVehicle.makeId}" valueChangeListener="#{quoteVehicle.changeMakeSelect}" immediate="true" required="#{quoteVehicle.vehicleRequired}" disabled="#{!quoteVehicle.vehicleMakeEnabled}">
                                                  <a4j:support event="onclick" reRender="filtermessage,bodystyletable,modeltable,fueltypetable,energylabeltable,typetable,carpic" ajaxSingle="true" limitToList="true" immediate="true" />
                                                  <f:selectItems value="#{quoteVehicle.vehicleMakeItems}" />
                                              </t:selectOneRadio>
                                              <t:dataTable newspaperColumns="7" cellpadding="0" cellspacing="0" var="row" value="#{quoteVehicle.dataModel}" rowIndexVar="index">
                                                  <h:column>
                                                    <t:radio for=":quote:make" index="#{index}" />
                                                  </h:column>
                                               </t:dataTable>
                                           </h:panelGroup>
                                      </h:panelGrid> 
                                  </td>
                              </tr>
                          </table>
      

       

      In the above code, when I select an item in the dropdown, the list of radiobuttons gets updates and rerendered.

      However, if I change the dropdown value and then click a radiobutton before that group is rerendered, I get the Exception.

       

      Now my question: is there a way I can prevent this exception, ie prevent handling the click on a radiobutton when that group is already waiting to get rerenderd.