Tobago Demo

Menu

Root Dummy Intro Search Getting Started Docker What's New Migration Compatibility FAQ API Download Server Info Logging Info In Suggest Textarea Date Range Group 5 Star Rating File Upload Out Label Badge Image Figure Progress Object Checkbox Toggle Dropdown Radio Listbox SelectOneList Multi Checkbox Multi Listbox Shuttle SelectManyList Button and Link Default Command Button Group Customizer Link Group Box Panel Separator Section Header and Footer Bar Popup Popover Toast Basic example Tab Client Tab Ajax Tab Server Basic example Sheet Sorting Paginator Sheet Column Selector Sheet Selectionchange Sheet Event Sheet Action Sheet Markup Sheet Style Empty Sheet Column Bar Sheet Filter Sheet Static Header Sheet Multi Header Sheet Tree Column Panel Sheet Editable Sheet Lazy Sheet Nested Basic example Tree Command Types Tree Select Tree Editor Tree Menu Tree Listbox Intro TinyMCE CKEditor Flow Layout Flex Layout Segment Layout Label Layout Grid Layout Split Layout Message-layout Overview Collapsible Box Collapsible Popup Collapsible Panel Collapsible Section Content Validation JSR 303 Severity Messages Content Security Policy Sanitize Roles Form AccessKey Focus Exception Handler Style Tag Bootstrap Theme Icons Partial Ajax Behavior WebSocket Transition Non Faces Request Conversion Error Handling For Each ConversationScoped Download Configuration Format Locale DataAttribute Meta
Root Dummy Intro Search Getting Started Docker What's New Migration Compatibility FAQ API Download Server Info Logging Info In Suggest Textarea Date Range Group 5 Star Rating File Upload Out Label Badge Image Figure Progress Object Checkbox Toggle Dropdown Radio Listbox SelectOneList Multi Checkbox Multi Listbox Shuttle SelectManyList Button and Link Default Command Button Group Customizer Link Group Box Panel Separator Section Header and Footer Bar Popup Popover Toast Basic example Tab Client Tab Ajax Tab Server Basic example Sheet Sorting Paginator Sheet Column Selector Sheet Selectionchange Sheet Event Sheet Action Sheet Markup Sheet Style Empty Sheet Column Bar Sheet Filter Sheet Static Header Sheet Multi Header Sheet Tree Column Panel Sheet Editable Sheet Lazy Sheet Nested Basic example Tree Command Types Tree Select Tree Editor Tree Menu Tree Listbox Intro TinyMCE CKEditor Flow Layout Flex Layout Segment Layout Label Layout Grid Layout Split Layout Message-layout Overview Collapsible Box Collapsible Popup Collapsible Panel Collapsible Section Content Validation JSR 303 Severity Messages Content Security Policy Sanitize Roles Form AccessKey Focus Exception Handler Style Tag Bootstrap Theme Icons Partial Ajax Behavior WebSocket Transition Non Faces Request Conversion Error Handling For Each ConversationScoped Download Configuration Format Locale DataAttribute Meta

Sheet Sorting

Sorting can be enable via the sortable attribute in the <tc:column/>. A custom sorting implementation can be set in the sortActionListener attribute in the <tc:sheet/>.

It's important to have a component inside the <tc:column/>, e.g. <tc:out value="#{object.name}"/>. If there is only a fragment like #{object.name}, sorting will not be possible!

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

Basics

In this example, the sortable attribute is 'true' for all columns. Notice, that there are negative periods.

<tc:column label="Name" sortable="true">
Name Period (Days) Discovery Year
Sun 0.0
Mercury 87.97
Venus 224.7
Earth 365.26
Rows 1 to 4 of 88
  • Page 1 of 22

Custom Sorting

All columns in this sheet can be sorted. A custom sorting implementation is set. Now, the sign for period numbers is ignored by sorting.

<tc:sheet value="#{sheetController.solarList}" var="solarobject" rows="4" sortActionListener="#{sheetController.sheetSorter}"> <tc:column id="namecol" label="Name" sortable="true"> ...
Name Period (Days) Discovery Year
Sun 0.0
Mercury 87.97
Venus 224.7
Earth 365.26
Rows 1 to 4 of 88
  • Page 1 of 22

Multi-Column Sorting

With the attribute maxSortColumns it is possible to visualize more than one sorting column. In this example you can sort by 3 columns. It works by clicking the column header in the reverse order. It's also possible to use ascending and descanding orders mixed.

It is also possible to use this via the API from the application like the button below shows.

Name Species Gender Age
Riley Cat male 22
Riley Cat female 23
Avery Cat female 11
Riley Goat male 24
Riley Pig female 27
James Goat male 18
James Pig male 20
Riley Pig male 26
James Cat female 17
Avery Cat male 10
Avery Pig male 14
Riley Goat female 25
Avery Goat male 12
James Goat female 19
James Cat male 16
James Pig female 21
Avery Pig female 15
Avery Goat female 13
© 2005-2025 Apache Software Foundation, Licensed under the Apache License, Version 2.0.