2 Replies Latest reply on Feb 18, 2009 8:30 PM by Nick Belaevski

    simpleTogglePanel onExpand event

    Kristof Vanhaeren Newbie

      Hi,

      I have a simpleTogglePanel in my view, in which resides a htmlPickList.
      Initially the togglePanel is not opened.
      When the user expands the panel the htmlPickList inside it must be populated, not before, as it is a fairly expensive operation.

      I have some code at the moment, which works, in a way, but the onExpand event is always executed for some reason (during page load, expanding and collapsing), but I only want it to execute when expanding the togglePanel.

      the code:


      <rich:simpleTogglePanel
       switchType="server"
       opened="false"
       width="370"
       bodyClass="selectUsersModule"
       label="User Criteria"
       onexpand="#{selectUsersModuleBean.populateUsersPickList}">
       <rich:pickList id="usersPickList"
       value="#{selectUsersModuleBean.targetUsers}"
       showButtonsLabel="false"
       converter="UserConverter">
       <f:selectItems value="#{selectUsersModuleBean.users}" />
       </rich:pickList>
       </rich:simpleTogglePanel>
      


      and in SelectUsersModuleBean:

      private String populateUsersPickList;
      
      ...
      
      public String getPopulateUsersPickList() {
       clearUsers();
      
       for (User user : userManager.createDummyUsers()) {
       SelectItem item = new SelectItem(user, user.getUsername());
       users.add(item);
       }
      
       return null;
       }
      


      As a side question, is is normal that I have to define the onExpand method in SelectUsersMouleBean like I do?
      It feels strange...

      Any ideas?

      thx