2 Replies Latest reply on Apr 24, 2008 7:47 AM by Ilya Kalujny

    Little confused about event handling sequence

    Ilya Kalujny Newbie

      Hi Everyone,

      I`m a bit confused about the sequence of method invocations.

      Suppose we got the following property in bean:


      private List<SelectItem> things = new ArrayList<SelectItem>();
      
      public List<SelectItem> getThings() {
       return this.things;
      }
      
      public void setThings(List<SelectItem> things) {
       this.things = things;
      }
      
      public void loadThings( ActionEvent event ) {
      this.things = fetchThings();
      }
      
      


      and the following .jspx part:

      <a4j:commandLink value="Modify Things" actionListener="#{bean.loadThings}" id="editThingsLink">
       <rich:componentControl for="thingsPanel" attachTo="editThingsLink" operation="show" event="onclick"/>
       </a4j:commandLink>
      
      ....
      
      
       <rich:modalPanel id="thingsPanel" >
      <h:selectOneListBox value="#{bean.selectedThing}">
       <f:selectItems value="#{bean.things}"/>
      </h:selectOneListBox>
      
      </rich:modalPanel>
      


      What i wanted was that when user clicks on the link it would execute loadThings actionlistener and then show the modal panel with freshly loaded things.

      Instead it calls getter for things first and only then executes actionlistener.

      I tried to use event="oncomplete" for component control that shows the modal panel but this way it never shows.

      Could anyone shed some light on this please? :)