Class zwt.ui.table.RowSorter
Extends
zwt.Object.
A row sorter provides default sorting using a table model. Basically a table requires a row sorter to map the row indices from the data model to the view.
This class provides the basis for sorting, you must override this class to provide a concrete table sorting support. Refer to zwt.ui.table.DefaultRowSorter for a concrete implementation.
Defined in: RowSorter.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Construct a row sorter.
|
Method Attributes | Method Name and Description |
---|---|
convertRowIndexToModel(int_viewIndex)
Convert the specified index in the view to the index in the underlying model.
|
|
convertRowIndexToView(int_modelIndex)
Convert the specified index in the underlying model to the index in the view.
|
|
getComparator(int_column)
Return the comparator associated to the specified column.
|
|
Return the row sorter event manager attached to the model.
|
|
Return the current sort keys.
|
|
isSortable(int_column)
Determine whether the specified column is sortable.
|
|
onEvent(zwt_ui_table_RowSorterEvent_event)
Dispatch the specified row sorter event to the appropriate event manager.
|
|
rowDeleted(int_firstRow, int_lastRow)
Invoked when rows have been deleted from the underlying model in the specified range (inclusive).
|
|
rowInserted(int_firstRow, int_lastRow)
Invoked when rows have been inserted from the underlying model in the specified range (inclusive).
|
|
rowUpdated(int_firstRow, int_lastRow)
Invoked when rows have been updated from the underlying model in the specified range (inclusive).
|
|
setComparator(int_column, zwt_Comparator_comparator)
Set the comparator for the specified column.
|
|
setSortKeys(array_sortKeys)
Set the sort keys and trigger a sort.
|
|
sort()
Sort the rows in the view based on the sort keys of the columns being sorted.
|
|
toggleSortOrder(int_column)
Reverse the sort order from ascending to descending (or descending to ascending) for the specified column.
|
- Parameters:
- {Integer} int_viewIndex
- The index of a row in the view
- Returns:
- The index of the row in the model
- Parameters:
- {Integer} int_modelIndex
- The index of a row in the model
- Returns:
- The index of the row in the view
Comparators are used during the sorting operation to compare cell values in columns.
- Parameters:
- {Integer} int_column
- The index of the column in the underlying model
- Returns:
- The Comparator.
- Returns:
- The row sorter event manager
- Returns:
- The sort keys
In this implementation, a column is sortable if a Comparator has been provided for this column.
- Parameters:
- {Integer} int_column
- The column to check
- Returns:
- true if the column is sortable, false otherwise
- Parameters:
- {zwt.ui.table.RowSorterEvent} zwt_ui_table_RowSorterEvent_event
- The row sorter event to dispatch
The arguments give the affected range in the model before the change.
- Parameters:
- {Integer} int_firstRow
- The first deleted row
- {Integer} int_lastRow
- The last deleted row
The arguments give the affected range in the model after the change.
- Parameters:
- {Integer} int_firstRow
- The first inserted row
- {Integer} int_lastRow
- The last inserted row
- Parameters:
- {Integer} int_firstRow
- The first updated row
- {Integer} int_lastRow
- The last updated row
- Parameters:
- {Integer} int_column
- The index of the column in the underlying model
- {zwt.Comparator} zwt_Comparator_comparator
- The comparator to set
This creates a copy of the specified array, further changes to this array will have no effects on the sorter.
- Parameters:
- {zwt.ui.table.RowSorter.SortKey[]} array_sortKeys
- The array of sort keys to set
If the specified column is not the primary sorted column, makes it the primary sorted column with an ascending sort order if it is currently unsorted or with an ascending or descending sort order depending on its initial state.
- Parameters:
- {Integer} int_column
- The index of the column in the underlying model to make the primary sorted column.