A TableInfo component supports sorting table data on one or more columns, in ascending or descending order. To support this functionality, the TableInfo maintains information about sort columns and their respective sort directions. A TableInfo also makes sorting instructions available to a form, where it can be used by standard ATG servlet beans such as ForEach and TableForEach.

A TableInfo constructs an array of Column objects from two properties:

The TableInfo stores this array of Column objects in TableInfo.tableColumns. Each Column object maintains information about itself in the following properties:

Column object property



Column display heading; read-only.

Note: See Localizing Column Headings for information about how the column heading is determined.


Column name; read-only.


The JavaBean property to display in the column; read-only.


The zero-based index of the column within the list of columns that are being sorted. 0 if the column is the primary sort column. –1 if the column is not sorted.


The 1-based index of the column within the list of columns to sort. 1 if the column is the primary sort column. 0 if the column is not sorted.


Column sort direction, set to ascending, descending, or none.

As shown by the code examples in later sections, you use TableInfo.tableColumns to iterate over the array of Column objects in order to obtain each column’s heading, name, and JavaBean property. You can also use JSP code to change the sort direction of a column or the sort order of columns in the table. When you do so, TableInfo automatically updates the sort properties for the affected Column objects. You can then render the table using only the primary sort column or all sort columns:

Note: TableInfo automatically updates primarySortString and sortString when you use JSP code to change a column’s sort direction or the columns’ sort order. You never explicitly set either of these TableInfo properties. Instead, you use them to obtain the current sorting instructions for the table.

If no explicit sorting is specified for table columns, you can use the defaultSortString property to specify a default sort order. If no explicit sort directions are set for a table, a call to getSortString returns defaultSortString, and a call to getPrimarySortString returns the first comma-separated token from defaultSortString.

For example, if defaultSortString is set to the string +name, then calling either getSortString or getPrimarySortString returns +name. If defaultSortString is set to the string +name, price, then calling getSortString returns +name, price, but calling getPrimarySortString returns only +name.

The value of defaultSortString is used only when the sortString property or primarySortString property otherwise returns an empty string. Setting defaultSortString does not modify the sort direction of any columns. Instead, it specifies the default sorting instructions to use if all of the columns are currently unsorted.

Copyright © 1997, 2013 Oracle and/or its affiliates. All rights reserved. Legal Notices