Static Header

There are several ways to display the header. For simple column headers, use the attribute label of <tc:column>. For more complex header which span over columns and/or rows please go to the Multi Header section.

Tag Library Documentation: <tc:sheet/> | <tc:column/>

Basics

A sheet with six rows. The name of the columns is set by the label attribute.

<tc:sheet value="#{sheetController.solarList}" var="object" rows="6">
  <tc:column label="Name">
    <tc:out value="#{object.name}"/>
  ...
Name Orbit Period (Days) Discoverer Year
Sun
-
0.0
-
Mercury
Sun
87.97
-
Venus
Sun
224.7
-
Earth
Sun
365.26
-
Mars
Sun
686.98
-
Jupiter
Sun
4332.71
-
  • Rows 1 to 6 of 88
  • Page 1 of 15

Scrolling Header

A sheet with ten rows and a maximal height of 500px. The header is scrollable.

To get a scrolling header, you have to set a maximal height and the width of all columns must be calculated automatically.

<tc:sheet value="#{sheetController.solarList}" var="object" rows="10">
  <tc:style maxHeight="500px"/>
  ...
Name Orbit Period (Days) Discoverer Year
Sun
-
0.0
-
Mercury
Sun
87.97
-
Venus
Sun
224.7
-
Earth
Sun
365.26
-
Mars
Sun
686.98
-
Jupiter
Sun
4332.71
-
Saturn
Sun
10759.5
-
Uranus
Sun
30685.0
Herschel
1781
Neptune
Sun
60190.0
Adams
1846
Pluto
Sun
90800.0
Tombaugh
1930
  • Rows 1 to 10 of 88
  • Page 1 of 9

Header always visible

A sheet with ten rows and a maximal height of 500px. The header is static.

To get a static header, you have to set a maximal height and the columns attribute must be used to set the width of the columns manually.

<tc:sheet value="#{sheetController.solarList}" var="object" rows="10"
      columns="3fr 80px 20% 2fr 1fr">
  <tc:style maxHeight="500px"/>
  ...
Name    Orbit    Period (Days)    Discoverer    Year   
Sun
-
0.0
-
Mercury
Sun
87.97
-
Venus
Sun
224.7
-
Earth
Sun
365.26
-
Mars
Sun
686.98
-
Jupiter
Sun
4332.71
-
Saturn
Sun
10759.5
-
Uranus
Sun
30685.0
Herschel
1781
Neptune
Sun
60190.0
Adams
1846
Pluto
Sun
90800.0
Tombaugh
1930
  • Rows 1 to 10 of 88
  • Page 1 of 9
<?xml version="1.0" encoding="UTF-8"?> <!-- * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. --> <ui:composition template="/main.xhtml" xmlns="http://www.w3.org/1999/xhtml" xmlns:tc="http://myfaces.apache.org/tobago/component" xmlns:ui="http://java.sun.com/jsf/facelets"> <ui:param name="title" value="#{demoBundle.sheet_static_header}"/> <p>There are several ways to display the header. For simple column headers, use the attribute <code>label</code> of <code class="language-markup">&lt;tc:column></code>. For more complex header which span over columns and/or rows please go to the <tc:link label="#{demoBundle.sheet_multi_header}" outcome="/content/20-component/080-sheet/60-multiheader/sheet-multi-header.xhtml"/> section.</p> <p>Tag Library Documentation: <tc:link label="&lt;tc:sheet/>" image="#{request.contextPath}/image/feather-leaf.png" link="#{demoBundle.tagDocUrl}/#{apiController.currentRelease}/tld/tc/sheet.html"/> | <tc:link label="&lt;tc:column/>" image="#{request.contextPath}/image/feather-leaf.png" link="#{demoBundle.tagDocUrl}/#{apiController.currentRelease}/tld/tc/column.html"/></p> <tc:section label="Basics"> <p>A sheet with six rows. The name of the columns is set by the <code>label</code> attribute.</p> <pre><code class="language-markup">&lt;tc:sheet value="\#{sheetController.solarList}" var="object" rows="6"> &lt;tc:column label="Name"> &lt;tc:out value="\#{object.name}"/> ...</code></pre> <tc:sheet id="simpleSheet" value="#{sheetController.solarList}" var="object" rows="6"> <tc:column label="Name"> <tc:out value="#{object.name}"/> </tc:column> <tc:column label="Orbit"> <tc:out value="#{object.orbit}"/> </tc:column> <tc:column label="Period (Days)"> <tc:out value="#{object.period}"/> </tc:column> <tc:column label="Discoverer"> <tc:out value="#{object.discoverer}"/> </tc:column> <tc:column label="Year"> <tc:out value="#{object.discoverYear}"/> </tc:column> </tc:sheet> </tc:section> <tc:section label="Scrolling Header"> <p>A sheet with ten rows and a maximal height of 500px. The header is scrollable.</p> <p>To get a scrolling header, you have to set a maximal height and the width of all columns must be calculated automatically.</p> <pre><code class="language-markup">&lt;tc:sheet value="\#{sheetController.solarList}" var="object" rows="10"> &lt;tc:style maxHeight="500px"/> ...</code></pre> <tc:sheet id="scrollHeaderSheet" value="#{sheetController.solarList}" var="object" rows="10"> <tc:style maxHeight="500px"/> <tc:column label="Name"> <tc:out value="#{object.name}"/> </tc:column> <tc:column label="Orbit"> <tc:out value="#{object.orbit}"/> </tc:column> <tc:column label="Period (Days)"> <tc:out value="#{object.period}"/> </tc:column> <tc:column label="Discoverer"> <tc:out value="#{object.discoverer}"/> </tc:column> <tc:column label="Year"> <tc:out value="#{object.discoverYear}"/> </tc:column> </tc:sheet> </tc:section> <tc:section label="Header always visible"> <p>A sheet with ten rows and a maximal height of 500px. The header is static.</p> <p>To get a static header, you have to set a maximal height and the <code>columns</code> attribute must be used to set the width of the columns manually.</p> <pre><code class="language-markup">&lt;tc:sheet value="\#{sheetController.solarList}" var="object" rows="10" columns="3fr 80px 20% 2fr 1fr"> &lt;tc:style maxHeight="500px"/> ...</code></pre> <tc:sheet id="alwaysVisibleHeaderSheet" value="#{sheetController.solarList}" var="object" rows="10" columns="3fr 80px 20% 2fr 1fr"> <tc:style maxHeight="500px"/> <tc:column label="Name"> <tc:out value="#{object.name}"/> </tc:column> <tc:column label="Orbit"> <tc:out value="#{object.orbit}"/> </tc:column> <tc:column label="Period (Days)"> <tc:out value="#{object.period}"/> </tc:column> <tc:column label="Discoverer"> <tc:out value="#{object.discoverer}"/> </tc:column> <tc:column label="Year"> <tc:out value="#{object.discoverYear}"/> </tc:column> </tc:sheet> </tc:section> </ui:composition>