title: Expanded PrimeFaces's DataTable's rows misbehavior
body: <p>I'm not sure whether or not this is a datatable's row expansion misbehavior or am I doing something wrong. I'll be as simple as possible with the problem's description.</p>
  
  <p>First, try making a DataTable like PrimeFaces's showcase for instance with a list of Car's in which you may "change" car's color. It's simple! </p>
  
  <p>Then implement its <code>rowExpansion</code> in order to do the partial processing of a property <code>ActionListener</code> set via commandButton. Till there, everything is alright. So now try expand the last row and after that try expanding middle's one then click over <code>commandButton</code> of the first expanded row then you'll notice that the property <code>ActionListener</code> set will be pointed or related to the second expanded row. In my example, I just populate datatable's with 3 rows.</p>
  
  <p>If you try to expand only one row you get the expected behavior. </p>
  
  <p>It seems that the expansion process overwrite previous processed model or some sort of other misbehavior that's away from knowledge.</p>
  
  <p>See the following snippets.</p>
  
  <pre><code>&lt;p:dataTable id="carsTable" var="car" value="#{bean.carsSmall}"&gt;
    &lt;p:ajax event="rowToggle" listener="#{bean.onRowToggle}" /&gt;
       &lt;p:column style="width:2%"&gt;
          &lt;p:rowToggler /&gt;
       &lt;/p:column&gt;
  
      &lt;p:column style="width:49%"&gt;
        &lt;h:outputText value="#{car.model}" /&gt;
      &lt;/p:column&gt;
  
      &lt;p:column style="width:49%"&gt;
        &lt;h:outputText value="#{car.year}" /&gt;
      &lt;/p:column&gt;
  
      &lt;p:rowExpansion&gt;
         &lt;ui:repeat var="color" value="#{bean.availableColors}"&gt;
            &lt;p:commandButton action="#{bean.chooseColor}" value="#{color.color}"&gt;
                &lt;f:setPropertyActionListener target="#{bean.selectedColor}" value="#{color}" /&gt;
            &lt;/p:commandButton&gt;
         &lt;/ui:repeat&gt;
  
      &lt;/p:rowExpansion&gt;
  &lt;/p:dataTable&gt;
  </code></pre>
  
  <p>Bean</p>
  
  <pre><code>@ManagedBean 
  @SessionScoped 
  public class Bean implements java.io.Serializable {
  
      private static final long serialVersionUID = 1708652163041196763L;
  
      private List&lt;Car&gt; carsSmall = new ArrayList&lt;Car&gt;();
      private final List&lt;Color&gt; availableColors = new ArrayList&lt;Color&gt;();
      private Color selectedColor;
  
      public Bean() {
          carsSmall.add(new Car("81025d15", "2011"));
          carsSmall.add(new Car("44194657", "2012"));
          carsSmall.add(new Car("482f2a60", "2013"));
      }
  
      public void clear(){
          this.availableColors.clear();
      }
  
      public void chooseColor(){
          System.out.println(this.selectedColor.getColor());
      }
  
      public void onRowToggle(ToggleEvent event) {
          // This is a dummy logic for this example...
          Car car = (Car) event.getData();
          this.availableColors.clear();
  
          if (car.getModel().equals("81025d15")) {
              this.availableColors.add(new Color("RED"));
              this.availableColors.add(new Color("GREEN"));
              this.availableColors.add(new Color("BLUE"));
          } else if (car.getModel().equals("44194657")) {
              this.availableColors.add(new Color("YELLOW"));
              this.availableColors.add(new Color("GRAY"));
              this.availableColors.add(new Color("BLACK"));
          } else if (car.getModel().equals("482f2a60")) {
              this.availableColors.add(new Color("ORANGE"));
              this.availableColors.add(new Color("BROWN"));
              this.availableColors.add(new Color("PINK"));
          }
  
      }
      // GETTERS and SETTERS...
  }
  </code></pre>
  
  <p>For those who will point the cause of issue the fact I'm using <code>&lt;ui:repeat&gt;</code>, this misbehavior is also noticed with either <code>&lt;h:dataTable&gt;</code> or <code>&lt;p:dataTable&gt;</code></p>
  
  <p>This example does not function with bean set as neither as <code>RequestScoped</code> nor <code>ViewScoped</code>.</p>