1 Reply Latest reply on Dec 17, 2010 10:34 PM by Delali Dzirasa

    selectOneMenu reRender not working with a4j:support

    Delali Dzirasa Newbie

      I can't seem to get the reRender of a selectOneMenu working read a bunch of post and seems like I am still missing something.  I want based on the office selected from a selectOneMenu to populate a list of people in that office in a pickList.  Can someone point me in the right direction please?  I also added a test tag (testID) which doesn't rerender either.



      Using: Seam 2.2
      Jboss: 5
      RichFces: 3.3.1


      Add office page



      <h:form>
            <s:validateAll>
      
              
                    <h:selectOneMenu id="officeCombo" value="#{sessionData.office}" converter="#{officeConverter}">
                                 <a4j:support event="onchange" reRender="testID, peopleList" ajaxSingle="true"/>
                                 <s:selectItems var="office" value="#{sessionData.offices}" label="#{office.officeNumber}" noSelectionLabel="Select office"/>
                        </h:selectOneMenu>        <br/>
                        
                        <h:outputText id="testID" value="#{sessionData.office.officeNumber}"/> <br/>
                        
                        <rich:pickList id="peopleList" value="#{peopleHandler.presentation.people}" 
                                             copyAllControlLabel="Select All" copyControlLabel="Select">
                                              <f:selectItems value="#{sessionData.peopleSelectItems}" />
                                              <s:convertEntity/>                
                    </rich:pickList>
                 
            </s:validateAll>
      </h:form>



      sessionData:



      @Name("sessionData")
      @Scope(ScopeType.SESSION)
      @AutoCreate
      public class SessionData {
      
      
              /** The personnel manager */
              @In(create = true)
              private PersonnelManager personnelManager;
      
              /** The current office */
              @In(create = true)
              private Office Office;
      
              /** The list of all field offices */
              private List<Office> offices;
      
              /** The current list of people in an office */
              private List<Person> people;
      
              /**
               * If empty, get all of the offices and stuff them into the session
               * 
               * @return the offices
               */
              public List<Office> getOffices() {
                      if (Offices == null) {
                              offices = new ArrayList<FieldOffice>();
                              offices = officeManager.getAllActiveOffices();
                      }
                      return offices;
              }
      
              /**
               * @param offices
               *            the offices to set
               */
              public void setOffices(List<Office> offices) {
                      people = personnelManager.getActivePeopleInOffice(office.getOfficeNumber());
                      this.offices = offices;
              }
      
      
              /**
               * @return the office
               */
              public Office getOffice() {
                      if (office == null) {
                              office = new Office();
                      }
                      return office;
              }
      
              /**
               * @param office
               *            the office to set
               */
              public void setOffice(Office office) {
                      System.out.print("SETTING THE OFFICE TO -" +  office.getOfficeNumber());
                      this.office = office;
                      
                      people = personnelManager.getActivePeopleInOffice(office.getOfficeNumber());
              }
      
              /**
               * @return the people
               */
              public List<Person> getPeople() {
                      if (people == null)
                      {
                              people = new ArrayList<Person>();
                      }
                      return people;
              }
      
              /**
               * @param people
               *            the people to set
               */
              public void setPeople(List<Person> people) {
                      this.people = people;
              }
      
                      /**
                       * Method used to people select items
                       * 
                       */
                      public List<SelectItem> getPeopleSelectItems() {
                      List<SelectItem> retList = new ArrayList<SelectItem>();
      
                      for (Person p : getPeople()) {
                          SelectItem si = new SelectItem();
                          si.setLabel(p.getName().getNameLastFirst());
                          si.setValue(p);
                          retList.add(si);
                      }
                      return retList;
                      }
      
      }