Data table components

The data table is a Faces component you can add to a Faces JSP page to display application data. It is a table-like control for displaying data from multiple database records. It consists of one or more columns, each with a header area and a data area. It is the data area of the column that repeats for each record.

You typically bind a data table to a record list or other data source, and the data table displays the data belonging to that record list. The data table contains columns, which act as containers for Faces components.

There are multiple ways to create a data table.

The data table offers great flexibility in how it is rendered on the user interface of your application. You can customize it in a variety of ways:

You can perform actions such as Read, Update, and Delete on the data displayed in a data table, and you can also create new data records. There are several ways to associate actions with a data table:

Important: If the component, whose value you want to use as a parameter is contained by a data table, manually add $$AJAXROW$$<component client id> to the parameter set. Where <component client id> is a client ID of the component whose value you want to send as the parameter. For example,

		
<h:form id="form1" styleClass="form">
     <hx:dataTableEx border="0" cellpadding="2" cellspacing="0" 
        columnClasses="columnClass1" headerClass="headerClass" 
        footerClass="footerClass" rowClasses="rowClass1, rowClass2" 
        id="tableEx1" styleClass="dataTableEx" value="#{company.employeeList}" 
        var="varEmployee">
          <hx:columnEx id="columnEx1">
               <f:facet name="header">
                    <h:outputText id="text1" styleClass="outputText" value="Id">
                    </h:outputText>
               </f:facet>
               <h:outputLink id="link1">
                    <h:outputText id="text2" styleClass="outputText" 
                       value="#{varEmployee.name}">
                    </h:outputText>
                    <hx:behavior event="onclick" behaviorAction="get;stop" 
                       targetAction="detailsBox"/>
               </h:outputLink>
               <h:inputHidden id="empId" value="#{varEmployee.Id}"/>
          </hx:columnEx>
     </hx:dataTableEx>
     <hx:panelBox id="detailsBox" styleClass="panelBox">
          <h:outputText id="text2" styleClass="putText" 
             value="#{company.employeeList[param.empId].department}">
          </h:outputText>
     </hx:panelBox>
     <hx:ajaxRefreshRequest id="ajaxExternalRequest1" target="detailsBox" 

 params="$$AJAXROW$$form1:tableEx1:empId" > </hx:ajaxRefreshRequest> </h:form>

The parameter set is a list of IDs separated by semicolons. The value of these components are retrieved and appended as params to the URL used to get the new content. The name of the param is the ID of the component.

 

Related tasks

Adding data to a JSF page using data viewing components

Editing a property template for JSF library components

Binding data to a JSF component

Adding and configuring a data table

Adding a header and footer to a data table

Managing columns in a data table

Adding paging to a data table

Adding row actions

Adding row category support to a data table

Passing parameters with data tables

Passing parameters between JSP files