To insert a selectable column, use the <tc:columnSelector/> tag. With the selectable in the <tc:sheet/> tag, you can adjust, whether the column should show checkboxes (default) or radio button 'singleOrNone'.
<tc:columnSelector/>
selectable
<tc:sheet/>
Tag Library Documentation: <tc:sheet/> | <tc:columnSelector/>
The first column in this sheet contain radio buttons. After clicking the submit button, the number of the selected row is displayed in the outputfield.
<tc:sheet value="#{sheetController.solarList}" var="solarobject" selectable="singleOrNone" rows="2" state="#{sheetController.sheetState}"> <tc:columnSelector/> <tc:column label="Name"> <tc:out value="#{solarobject.name}"/> </tc:column> ...
<?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" xmlns:f="http://java.sun.com/jsf/core"> <ui:param name="title" value="#{demoBundle.sheet_column_selector} <tc:columnSelector>"/> <p>To insert a selectable column, use the <code class="language-markup"><tc:columnSelector/></code> tag. With the <code>selectable</code> in the <code class="language-markup"><tc:sheet/></code> tag, you can adjust, whether the column should show checkboxes (default) or radio button 'singleOrNone'.</p> <p>Tag Library Documentation: <tc:link label="<tc:sheet/>" image="#{request.contextPath}/image/feather-leaf.png" link="#{demoBundle.tagDocUrl}/#{info.stableVersion}/tld/tc/sheet.html"/> | <tc:link label="<tc:columnSelector/>" image="#{request.contextPath}/image/feather-leaf.png" link="#{demoBundle.tagDocUrl}/#{info.stableVersion}/tld/tc/columnSelector.html"/></p> <tc:section label="Column Selector"> <p>The first column in this sheet contain radio buttons. After clicking the submit button, the number of the selected row is displayed in the outputfield.</p> <pre><code class="language-markup"><tc:sheet value="\#{sheetController.solarList}" var="solarobject" selectable="singleOrNone" rows="2" state="\#{sheetController.sheetState}"> <tc:columnSelector/> <tc:column label="Name"> <tc:out value="\#{solarobject.name}"/> </tc:column> ...</code></pre> <tc:sheet id="s4" value="#{sheetController.solarList}" var="object" rows="2" selectable="#{sheetController.selectable}" state="#{sheetController.sheetState}"> <tc:columnSelector/> <tc:column label="Name"> <tc:in value="#{object.name}" labelLayout="skip"/> </tc:column> <tc:column label="Orbit"> <tc:out value="#{object.orbit}" labelLayout="skip"/> </tc:column> <tc:column label="Period (Days)"> <tc:out value="#{object.period}" labelLayout="skip"/> </tc:column> <tc:column label="Discoverer"> <tc:out value="#{object.discoverer}" labelLayout="skip"/> </tc:column> <tc:column label="Year"> <tc:out value="#{object.discoverYear}" labelLayout="skip"/> </tc:column> </tc:sheet> <tc:selectOneRadio label="Mode" value="#{sheetController.selectable}" required="true"> <tc:selectItems value="#{sheetController.selectableModes}"/> <f:ajax render="s4"/> </tc:selectOneRadio> <tc:button id="b1" label="Submit"/> <tc:out id="o1" label="Row Number" value="#{sheetController.sheetState.selectedRows}"/> </tc:section> </ui:composition>