Home

# Class goog.ui.TableSorter

A table sorter allows for sorting of a table by column. This component can be used to decorate an already existing TABLE element with sorting features. The TABLE should use a THEAD containing TH elements for the table column headers.

extends goog.ui.Component

Instance Method Summary
| `canDecorate(?Element element) ⇒ boolean` Determines if a given element can be decorated by this type of component. This method should be overridden by inheriting objects.
| `enterDocument()` Called when the component's element is known to be in the document. Anything using document.getElementById etc. should be done at this stage. If the component contains child components, this call is propagated to its children.
| `getDefaultSortFunction() ⇒ function (*, *): number`
| `getSortColumn() ⇒ number`
| `getSortFunction(number column) ⇒ function (*, *): number` Gets the sort function to be used by the given column. Returns the default sort function if no sort function is explicitly set for this column.
| `isSortReversed() ⇒ boolean`
| `setDefaultSortFunction(function (*, *): number sortFunction)` Sets the default sort function to be used by all columns. If not set explicitly, this defaults to numeric sorting.
| `setSortFunction(number column, function (*, *): number sortFunction)` Set the sort function for the given column, overriding the default sort function.
| `setSortableHeaderRowIndex(number index)` Sets the row index (in ) to be used for sorting. By default, the first row (index 0) is used. Must be called before decorate() is called.
| `sort(number column, boolean= opt_reverse) ⇒ boolean` Sort the table contents by the values in the given column.
| `sort_(?goog.events.BrowserEvent e)` Sort the table contents by the values in the given column.

Static Method Summary
| `createReverseSort(function (*, *): number sortFunction) ⇒ function (*, *): number` Returns a function that is the given sort function in reverse.
| `numericSort(<Any Type> a, <Any Type> b) ⇒ number` A numeric sort function.