title: Best way to make an expandable/collapsible subTable with rich:dataTable
body: <p>I've recently ported an application from JSF 1.1 to JSF 1.2. In the process we removed tomahawk and decided to use rich instead.</p>
  
  <p>Now I need a way to make an expandable/collapsible detailViev for each row in the table. </p>
  
  <p>The only thing I can think of is something along these lines (adapted from documentation at docs.jboss.com):</p>
  
  <pre><code>&lt;rich:dataTable value="#{capitalsBean.capitals}" var="capitals"&gt;
      &lt;rich:column&gt;
          ...
      &lt;/rich:column&gt;
      &lt;rich:subTable value="#{capitals.details}" var="detail" ajaxKeys="#{bean.ajaxSet}" binding="#{bean.subtable}" id="subtable" rendered="detail.detailOpened"&gt;
          &lt;rich:column&gt;
              ...
          &lt;/rich:column&gt;
      &lt;/rich:subTable&gt;
  &lt;/rich:dataTable&gt;
  </code></pre>
  
  <p>I guess something like that would work. The problem is that I either have to add a getDetailOpened and a setDetailOpened to the objects I use, or wrap each object in another object that provides those two methods.</p>
  
  <p>Anybody knows a better way, or how it is supposed to be done?</p>