<?xml version='1.0' encoding='UTF-8'?>

<section>
  <sectioninfo>
    <keywordset>
      <keyword>table</keyword>
      <keyword>rich:dataTable</keyword>
      <keyword>HtmlDataTable</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.DataTable</entry>
        </row>
        <row>
          <entry>component-class</entry>
          <entry>org.richfaces.component.html.HtmlDataTable</entry>
        </row>
        <row>
          <entry>component-family</entry>
          <entry>org.richfaces.DataTable</entry>
        </row>
        <row>
          <entry>renderer-type</entry>
          <entry>org.richfaces.DataTableRenderer</entry>
        </row>
        <row>
          <entry>tag-class</entry>
          <entry>org.richfaces.taglib.DataTableTag</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:dataTable>
...
]]></programlisting>
  </section>
  <section>
    <title>Creating the Component Dynamically from Java</title>

    <para>
      <emphasis role="bold">Example:</emphasis>
    </para>
    <programlisting role="JAVA"><![CDATA[import org.richfaces.component.html.HtmlDataTable;
...
HtmlDataTable myTable = new HtmlDataTable();
...
]]></programlisting>
  </section>
  <section>
    <title>Details of Usage</title>
    <para>The <emphasis role="bold">
        <property>&lt;rich:dataTable&gt;</property>
      </emphasis> component is similar to the <emphasis role="bold">
        <property>&lt;h:dataTable&gt;</property>
      </emphasis> one, except Ajax support and skinnability. 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"
                ajaxKeys="#{bean.ajaxSet}" binding="#{bean.table}" id="table">
        ...
    </rich:dataTable>
...
    <a4j:commandButton action="#{tableBean.action}" reRender="table" value="Submit"/>
...
]]></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:dataTable&gt;</property>
      </emphasis> component. As a result the component is updated after an Ajax request.</para>

    <para  id="table_ex">The component allows to use <emphasis>
      <property>&quot;header&quot;</property>
    </emphasis>, <emphasis>
      <property>&quot;footer&quot;</property>
    </emphasis> and <emphasis>
      <property>&quot;caption&quot;</property>
    </emphasis> facets for output. See an example below:</para>

    <para>
      <emphasis role="bold">Example:</emphasis>
    </para>
    <programlisting role="XML"><![CDATA[...
    <rich:dataTable value="#{capitalsBean.capitals}" var="cap" rows="5">
        <f:facet name="caption"><h:outputText value="United States Capitals" /></f:facet>
        <f:facet name="header"><h:outputText value="Capitals and States Table" /></f:facet>
        <rich:column>
            <f:facet name="header">State Flag</f:facet>
            <h:graphicImage value="#{cap.stateFlag}"/>
            <f:facet name="footer">State Flag</f:facet>
        </rich:column>
        <rich:column>
            <f:facet name="header">State Name</f:facet>
            <h:outputText value="#{cap.state}"/>
            <f:facet name="footer">State Name</f:facet>
        </rich:column>
        <rich:column >
            <f:facet name="header">State Capital</f:facet>
            <h:outputText value="#{cap.name}"/>
            <f:facet name="footer">State Capital</f:facet>
        </rich:column>
        <rich:column>
            <f:facet name="header">Time Zone</f:facet>
            <h:outputText value="#{cap.timeZone}"/>
            <f:facet name="footer">Time Zone</f:facet>
        </rich:column>
        <f:facet name="footer"><h:outputText value="Capitals and States Table" /></f:facet>
    </rich:dataTable>
...
]]></programlisting>

    <para>This is a result:</para>

    <figure>
      <title><emphasis role="bold">
        <property>&lt;rich:dataTable&gt;</property>
      </emphasis> component with facets</title>
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/dataTable2.png"/>
        </imageobject>
      </mediaobject>
    </figure>
    <para>Information about sorting and filtering you can find <link linkend="sortAndFilter">in the corresponding section</link>.</para>
    <para>
      You can find information how to remove header's gradient <ulink url="http://wiki.jboss.org/wiki/RichFacesDataTableBackgroundOut"> in the &quot;How to remove rich:dataTable header background &quot; article</ulink>.
    </para>
  </section>
  
  <section>
    <title>Facets</title>
    <table>
      <title>Facets</title>
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Facet</entry>
            <entry>Description</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>header</entry>
            <entry>Redefines the header content</entry>
          </row>
          <row>
            <entry>footer</entry>
            <entry>Redefines the footer content</entry>
          </row>
          <row>
            <entry>caption</entry>
            <entry>Defines the caption 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:dataTable&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:dataTable&gt;</property>
          </emphasis> component</para>
      </listitem>
    </itemizedlist>
  </section>

  <section id="SPR">
    <title>Skin Parameters Redefinition</title>

    <table>
      <title>Skin parameters redefinition for a table</title>
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Skin parameters</entry>
            <entry>CSS properties</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>tableBackgroundColor</entry>
            <entry>background-color</entry>
          </row>
        </tbody>
      </tgroup>
    </table>

    <table>
      <title>Skin parameters redefinition for a header</title>
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Skin parameters</entry>
            <entry>CSS properties</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>headerBackgroundColor</entry>
            <entry>background-color</entry>
          </row>
        </tbody>
      </tgroup>
    </table>

    <table>
      <title>Skin parameters redefinition for a footer</title>
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Skin parameters</entry>
            <entry>CSS properties</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>tableFooterBackgroundColor</entry>
            <entry>background-color</entry>
          </row>
        </tbody>
      </tgroup>
    </table>

    <table>
      <title>Skin parameters redefinition for a column header</title>
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Skin parameters</entry>
            <entry>CSS properties</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>additionalBackgroundColor</entry>
            <entry>background-color</entry>
          </row>
        </tbody>
      </tgroup>
    </table>

    <table>
      <title>Skin parameters redefinition for a column footer</title>
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Skin parameters</entry>
            <entry>CSS properties</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>tableSubfooterBackgroundColor</entry>
            <entry>background-color</entry>
          </row>
        </tbody>
      </tgroup>
    </table>

    <table>
      <title>Skin parameters redefinition for cells</title>
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Skin parameters</entry>
            <entry>CSS properties</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>generalSizeFont</entry>
            <entry>font-size</entry>
          </row>
          <row>
            <entry>generalTextColor</entry>
            <entry>color</entry>
          </row>
          <row>
            <entry>generalFamilyFont</entry>
            <entry>font-family</entry>
          </row>
        </tbody>
      </tgroup>
    </table>

  </section>

  <section id="DofCCS">
    <title>Definition of Custom Style Classes</title>

    <para>On the screenshot there are classes names that define styles for component elements.</para>

    <figure>
      <title><emphasis role="bold"><property>&lt;rich:dataTable&gt;</property></emphasis> class names</title>
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/dataTable_cn.png" scalefit="1"/>
        </imageobject>
      </mediaobject>
    </figure>

    <table id="dTC">
      <title>Classes names that define a whole component appearance</title>
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Class name</entry>
            <entry>Description</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>rich-table</entry>
            <entry>Defines styles for all table</entry>
          </row>
          <row>
            <entry>rich-table-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-table-header</entry>
            <entry>Defines styles for a table header row</entry>
          </row>

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

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

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

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

          <row>
            <entry>rich-table-subheadercell</entry>
            <entry>Defines styles for a column header cell</entry>
          </row>
          <row>
            <entry>rich-table-cell</entry>
            <entry>Defines styles for a table cell</entry>
          </row>
          <row>
            <entry>rich-table-row</entry>
            <entry>Defines styles for a table row</entry>
          </row>
          <row>
            <entry>rich-table-firstrow</entry>
            <entry>Defines styles for a table&apos;s first  row</entry>
          </row>

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

          <row>
            <entry>rich-table-subfootercell</entry>
            <entry>Defines styles for a column footer cell</entry>
          </row>
        </tbody>
      </tgroup>
    </table>

    <para>In order to redefine styles for all <emphasis role="bold">
      <property>&lt;rich:dataTable&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="dTC"> above</link>) and define necessary properties in them. </para>

    <para>
      <emphasis role="bold">Example:</emphasis>
    </para>
    <programlisting role="CSS"><![CDATA[...
.rich-table-cell{
    font-weight:bold;
}
...]]></programlisting>

    <para>This is a result:</para>

    <figure>
      <title>Redefinition styles with predefined classes</title>
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/dataTable_pc.png"/>
        </imageobject>
      </mediaobject>
    </figure>

    <para>In the example the font weight for table cell was changed.</para>

    <para>Also it&apos;s possible to change styles of particular <emphasis role="bold"
      ><property>&lt;rich:dataTable&gt;</property></emphasis> component. In this case you should create own style classes and use them in corresponding <emphasis role="bold"
        ><property>&lt;rich:dataTable&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{
    font-style:italic;
}
...]]></programlisting>
    <para>The <emphasis><property>&quot;headerClass&quot;</property></emphasis> attribute for <emphasis role="bold"
      ><property>&lt;rich:dataTable&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:dataTable  ... headerClass="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/dataTable_oc.png"/>
        </imageobject>
      </mediaobject>
    </figure>

    <para>As it could be seen on the picture above, the font style for header was changed.</para>

    <para>
    	Detailed information on how to set
    	<emphasis role="bold">
    		<property>&lt;rich:dataTable&gt;</property>
    	</emphasis>
    	border to &quot;0px&quot; you can find in  the 
    	<ulink
    		url="http://www.jboss.org/community/docs/DOC-11861">
    	 &quot; How to set rich:dataTable border to 0px article &quot; 
    	</ulink>
    	.
    </para>


  </section>
  <section>
    <title>Relevant Resources Links</title>
    <para>
      <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/dataTable.jsf?c=dataTable"
        >On the component LiveDemo page</ulink> you can see the example of <emphasis role="bold">
        <property>&lt;rich:dataTable&gt;</property>
      </emphasis> usage and sources for the given example. </para>
    <para>The article about <emphasis role="bold">
        <property>&lt;rich:dataTable&gt;</property>
      </emphasis> flexibility can be found in the  <ulink
        url="http://www.jboss.org/community/docs/DOC-11847"> &quot;rich:dataTable Flexibility &quot; article </ulink>.</para>
    <para>
      <ulink url="http://www.jboss.org/community/docs/DOC-11848">Article on dataTable skinability</ulink>  provides you a simple example of skinnability.
      
    </para>
    <para>More information about using <emphasis role="bold">
        <property>&lt;rich:dataTable&gt;</property>
      </emphasis> and <emphasis role="bold">
        <property>&lt;rich:subTable&gt;</property>
      </emphasis> could be found on the <ulink
        url="http://www.jboss.com/index.html?module=bb&amp;op=viewtopic&amp;p=4059044#4059044"
        >RichFaces Users Forum</ulink>.
    </para>
    <para>How to use <emphasis role="bold">
        <property>&lt;rich:dataTable&gt;</property>
      </emphasis> and <emphasis role="bold">
        <property>&lt;rich:datascroller&gt;</property>
      </emphasis> in a context of Extended Data Model see on the <ulink
        url="http://www.jboss.com/index.html?module=bb&amp;op=viewtopic&amp;t=115636"
        >RichFaces Users Forum</ulink>.</para>
       
    <para>From <ulink url="http://www.jboss.org/community/docs/DOC-11861">&quot;rich:dataTable border to 0px &quot;</ulink> article you'll figure out how to set rich:dataTable border to 0px </para>
    <para><ulink url="http://www.jboss.org/community/docs/DOC-11860">dataTable Background Out </ulink> tells you how to remove rich:dataTable header background</para>
  </section>
</section>
