<?xml version='1.0' encoding='UTF-8'?>
<section>
  <sectioninfo>
    <keywordset>
      <keyword>rich:subTable</keyword>
      <keyword>HtmlSubTable</keyword>
    </keywordset>
  </sectioninfo>

  <table>
    <title>Component identification parameters </title>
    <tgroup cols="2">
      <thead>
        <row>
          <entry>Name</entry>
          <entry>Value</entry>
        </row>
      </thead>
      <tbody>
        <row>
          <entry>component-type</entry>
          <entry>org.richfaces.SubTable</entry>
        </row>
        <row>
          <entry>component-class</entry>
          <entry>org.richfaces.component.html.HtmlSubTable</entry>
        </row>
        <row>
          <entry>component-family</entry>
          <entry>org.richfaces.SubTable</entry>
        </row>
        <row>
          <entry>renderer-type</entry>
          <entry>org.richfaces.SubTableRenderer</entry>
        </row>
        <row>
          <entry>tag-class</entry>
          <entry>org.richfaces.taglib.SubTableTag</entry>
        </row>
      </tbody>
    </tgroup>
  </table>

  <section>
    <title>Creating the Component with a Page Tag</title>
    <para>Here is a simple example as it could be used on a page:</para>

    <para>
      <emphasis role="bold">Example:</emphasis>
    </para>
    <programlisting role="XML"><![CDATA[...
     <rich:dataTable value="#{capitalsBean.capitals}" var="capitals">
        <rich:column>
            ...
        </rich:column>
        <rich:subTable value=#{capitals.details} var="detail">
            <rich:column>
                ...
            </rich:column>
        </rich:subTable>
    </rich:dataTable>
...
]]></programlisting>
  </section>
  <section>
    <title>Creating the Component Dynamically Using Java</title>

    <para>
      <emphasis role="bold">Example:</emphasis>
    </para>
    <programlisting role="JAVA"><![CDATA[import org.richfaces.component.html.HtmlSubTable;
...
HtmlSubTable mySubTable = new HtmlSubTable();
...
]]></programlisting>
  </section>
  <section>
    <title>Details of Usage</title>

    <para>The <emphasis role="bold">
        <property>&lt;rich:subTable&gt;</property>
      </emphasis> component is similar to the <emphasis role="bold">
        <property>&lt;h:dataTable&gt;</property>
      </emphasis> one, except Ajax support and skinnability. One more difference is that the
      component doesn&apos;t add the wrapping <emphasis role="bold">
        <property>&lt;table&gt;</property>
      </emphasis> and <emphasis role="bold">
        <property>&lt;tbody&gt;</property>
      </emphasis> tags. Ajax support is possible, because the component was created basing on the
        <emphasis role="bold">
        <property>&lt;a4j:repeat&gt;</property>
      </emphasis> component and as a result it could be partially updated with Ajax. <emphasis>
        <property>&quot;ajaxKeys&quot;</property>
      </emphasis> attribute allows to define row keys that is updated after an Ajax request.</para>

    <para>Here is an example:</para>
    
    <para>
      <emphasis role="bold">Example:</emphasis>
    </para>
    
    <programlisting role="XML"><![CDATA[...
    <rich:dataTable value="#{capitalsBean.capitals}" var="capitals">
        <rich:column>
            ...
        </rich:column>
        <rich:subTable value="#{capitals.details}" var="detail" ajaxKeys="#{bean.ajaxSet}" binding="#{bean.subtable}" id="subtable">
            <rich:column>
                ...
            </rich:column>
        </rich:subTable>
    </rich:dataTable>
...
    <a4j:commandButton action="#{tableBean.action}" reRender="subtable"/>
...
]]></programlisting>
    <para> In the example <emphasis>
        <property>&quot;reRender&quot;</property>
      </emphasis> attribute contains value of <emphasis>
        <property>&quot;id&quot;</property>
      </emphasis> attribute for <emphasis role="bold">
        <property>&lt;rich:subTable&gt;</property>
      </emphasis> component. As a result the component is updated after an Ajax request.</para>

    <para>The component allows to use <emphasis>
        <property>&quot;header&quot;</property>
      </emphasis> and <emphasis>
        <property>&quot;footer&quot;</property>
      </emphasis> facets for output. See an example for <emphasis role="bold">
        <property>&lt;rich:dataTable&gt;</property>
      </emphasis>
      <link linkend="table_ex">component</link>.</para>

  </section>
  
  <section>
    <title>Facets</title>
    <table>
      <title>Facets</title>
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Facet name</entry>
            <entry>Description</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>header</entry>
            <entry>Defines the header content</entry>
          </row>
          <row>
            <entry>footer</entry>
            <entry>Defines the footer content</entry>
          </row>
        </tbody>
      </tgroup>
    </table>
  </section>
  
  <section>
    <title>Look-and-Feel Customization</title>

    <para>For skinnability implementation, the components use a <emphasis>
        <property>style class redefinition method.</property>
      </emphasis> Default style classes are mapped on <emphasis>
        <property>skin parameters.</property>
      </emphasis></para>

    <para>There are two ways to redefine the appearance of all <emphasis role="bold">
        <property>&lt;rich:subTable&gt;</property>
      </emphasis> components at once:</para>

    <itemizedlist>
      <listitem>
        <para>Redefine the corresponding skin parameters</para>
      </listitem>

      <listitem>
        <para>Add to your style sheets <emphasis>
            <property>style classes</property>
          </emphasis> used by a <emphasis role="bold">
            <property>&lt;rich:subTable&gt;</property>
          </emphasis> component</para>
      </listitem>
    </itemizedlist>
  </section>

  <section>
    <title>Skin Parameters Redefinition</title>

    <para>Skin parameters redefinition for <emphasis role="bold">
        <property>&lt;rich:subTable&gt;</property>
      </emphasis> are the same as for the <emphasis role="bold">
        <property>&lt;rich:dataTable&gt;</property>
      </emphasis>
      <link linkend="SPR">component</link>.</para>
  </section>

  <section>
    <title>Definition of Custom Style Classes</title>

    <table id="tab_sT">
      <title>Classes names that define a component appearance</title>
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Class name</entry>
            <entry>Description</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>rich-subtable</entry>
            <entry>Defines styles for all subtable</entry>
          </row>
          <row>
            <entry>rich-subtable-caption</entry>
            <entry>Defines styles for a &quot;caption&quot; facet element</entry>
          </row>

        </tbody>
      </tgroup>
    </table>

    <table>
      <title>Classes names that define header and footer elements</title>
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Class name</entry>
            <entry>Description</entry>
          </row>
        </thead>
        <tbody>

          <row>
            <entry>rich-subtable-header</entry>
            <entry>Defines styles for a subtable header row</entry>
          </row>

          <row>
            <entry>rich-subtable-header-continue</entry>
            <entry>Defines styles for all subtable header lines after the first</entry>
          </row>
          <row>
            <entry>rich-subtable-subheader</entry>
            <entry>Defines styles for a column header of subtable</entry>
          </row>

          <row>
            <entry>rich-subtable-subfooter</entry>
            <entry>Defines styles for a column footer of subtable</entry>
          </row>

          <row>
            <entry>rich-subtable-footer</entry>
            <entry>Defines styles for a subtable footer row</entry>
          </row>

          <row>
            <entry>rich-subtable-footer-continue</entry>
            <entry>Defines styles for all subtable footer lines after the first</entry>
          </row>
        </tbody>
      </tgroup>
    </table>

    <table>
      <title>Classes names that define rows and cells</title>
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Class name</entry>
            <entry>Description</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>rich-subtable-headercell</entry>
            <entry>Defines styles for a subtable header cell</entry>
          </row>

          <row>
            <entry>rich-subtable-subheadercell</entry>
            <entry>Defines styles for a column header cell of subtable</entry>
          </row>
          <row>
            <entry>rich-subtable-cell</entry>
            <entry>Defines styles for a subtable cell</entry>
          </row>
          <row>
            <entry>rich-subtable-row</entry>
            <entry>Defines styles for a subtable row</entry>
          </row>
          <row>
            <entry>rich-subtable-firstrow</entry>
            <entry>Defines styles for a subtable start row</entry>
          </row>

          <row>
            <entry>rich-subtable-subfootercell</entry>
            <entry>Defines styles for a column footer cell of subtable</entry>
          </row>

          <row>
            <entry>rich-subtable-footercell</entry>
            <entry>Defines styles for a subtable footer cell</entry>
          </row>

        </tbody>
      </tgroup>
    </table>
    <figure>
      <title>Style classes</title>
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/subTable_cn.png"/>
        </imageobject>
      </mediaobject>
    </figure>
    <para>In order to redefine styles for all <emphasis role="bold">
      <property>&lt;rich:subTable&gt;</property>
    </emphasis> components on a page using CSS, it&apos;s enough to create classes with the
      same names (possible classes could be found in the tables <link linkend="tab_sT"> above</link>) and define necessary properties in them. </para>
    
    <para>
      <emphasis role="bold">Example:</emphasis>
    </para>
    <programlisting role="CSS"><![CDATA[...
.rich-subtable-footer{
        font-weight: bold;
}	
...]]></programlisting>  
    
    <para>This is a result:</para>
    
    <figure>
      <title>Redefinition styles with predefined classes</title>
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/subTable_pc.png"/>
        </imageobject>
      </mediaobject>
    </figure>
    
    <para>In the example a footer font weight was changed.</para>
    
    <para>Also it&apos;s possible to change styles of particular <emphasis role="bold"
      ><property>&lt;rich:subTable&gt;</property></emphasis> component. In this case you should create own style classes and use them in corresponding <emphasis role="bold"
        ><property>&lt;rich:subTable&gt;</property></emphasis> <emphasis><property>styleClass</property></emphasis> attributes. An example is placed below:</para>
    
    <para>
      <emphasis role="bold">Example:</emphasis>
    </para>
    <programlisting role="CSS"><![CDATA[...
.myClass{
	background-color: #fff5ec;
}
...]]></programlisting>  
    <para>The <emphasis><property>&quot;columnClasses&quot;</property></emphasis> attribute for <emphasis role="bold"
      ><property>&lt;rich:subTable&gt;</property></emphasis> is defined as it&apos;s shown in the example below:</para>
    
    <para>
      <emphasis role="bold">Example:</emphasis>
    </para>
    <programlisting role="XML"><![CDATA[<rich:subTable ... columnClasses="myClass"/>
]]></programlisting>    
    
    <para>This is a result:</para>
    
    <figure>
      <title>Redefinition styles with own classes and <emphasis><property>styleClass</property></emphasis> attributes</title>
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/subTable_oc.png"/>
        </imageobject>
      </mediaobject>
    </figure>  
    
    <para>As it could be seen on the picture above, the background color for columns was changed.</para>
  </section>
</section>
