0 Replies Latest reply on Jul 23, 2007 1:26 PM by Thomas Roman

    Problem with dynamic simpleTogglePanels inside a tabPanel

    Thomas Roman Newbie

      I?m having a problem with dynamically generated rich:simpleTogglePanels within a rich:dataGrid (or rich:dataTable) that are wrapped within a rich:tabPanel. I can click the simpleTogglePanels and it opens as expected. If I change tabs and go back to the tab containing the simpleTogglePanels, all of the simpleTogglePanels within the dataGrid/dataTable are opened. If I close one of the simpleTogglePanels and switch tabs again and go back, all of the simpleTogglePanels are closed.

      It only seems to occur with simpleTogglePanels within the dataGrid/dataTable because as you can see from my example code, the simpleTogglePanels outside the dataGrid/dataTable behave as expected when switching tabs.

      Any ideas? I?m fairly new to JSF/Richfaces so let me know if I?ve made incorrect assumptions?


      FYI: Using Jboss 4.2.0GA/Seam 2.0.0.BETA1/Richfaces 3.0.1/Ajax4jsf 1.1.1

      Note: the local interface ?ListChannels? is omitted to save a little space?

      Markup for Main page with tabPanel:
      <ui:composition (namespaces removed)>
       <ui:define name=?body?>
       <rich:tabPanel switchType=?ajax?>
       <rich:tab label=?Home?>
       <f:facet name=?header?>Home</f:facet>
       <p>Put interesting Home stuff here</p>
       <rich:tab label=?Control?>
       <div class=?control?>
       <ui:include src=?controlNew.xhtml?/>
       <rich:tab label=?Queries?>
       <f:facet name=?header?>DB Query</f:facet>
       <p>Put DB Query components here</p>
      Markup for ?Control? tab containing togglePanels (controlNew.xhtml):
      <rich:panel (namespaces removed)>
       <f:facet name=?header?>Control Grid</f:facet>
       <h:outputText value=?No Channels Configured?
       <rich:dataGrid id=?chanGrid? var=?channel? value=?#{channels}?
       rendered=?#{channels.rowCount>0}? border=?0?
       cellspacing=?5? columns=?1?>
       <rich:simpleTogglePanel opened=?false? switchType=?ajax?
       label=?#{channel.channelId} #{channel.name}?>
       <h:outputText value=?Put control components here??/>
       <!? These simpleTogglePanels behave as expected when traversing
       the tabPanel tabs? à
       <rich:simpleTogglePanel opened=?false? switchType=?ajax? label=?Test One?>
       <h:outputText value=?Put something in here?/>
       <rich:simpleTogglePanel opened=?false? switchType=?ajax? label=?Test Two?>
       <h:outputText value=?Put something in here?/>
       <rich:simpleTogglePanel opened=?false? switchType=?ajax? label=?Test Two?>
       <h:outputText value=?Put something in here?/>
      Here is the backing bean (ListChannelAction):
      package components;
      import static org.jboss.seam.ScopeType.SESSION;
      import java.io.Serializable;
      import java.util.*;
      import javax.ejb.*;
      import javax.persistence.*;
      import org.jboss.seam.annotations.*;
      import org.jboss.seam.annotations.datamodel.*;
      import org.jboss.seam.log.Log;
      import pojos.Channel;
      public class ListChannelAction implements ListChannels, Serializable {
       private static final long serialVersionUID = 1L;
       private Log log;
       private List<Channel> channels;
       private Channel channel;
       public void getChannels() {
       // Hard-coded channel create for now
       int numchannels=3;
       channels = new ArrayList<Channel>();
       for (int I=0; I < numChannels; I++) {
       channels.add(new Channel(I, ?Channel ?+I));
       @Destroy @Remove
       public void destroy() {}
      And the POJO representing ?Channel?:
      package pojos;
      import java.io.Serializable;
      public class Channel implements Serializable {
       private static final long serialVersionUID = 1L;
       private int channelId;
       private String name;
       public Channel() {}
       public Channel(int channelId, String name) {
       this.channelId = channelId;
       this.name = name;
       // (Sets and Gets removed for space)