Constructor
new SimpleSortDescriptor(columnIndex, descendingopt, columnTypeopt)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
columnIndex |
number | Column index for which this descriptor applies. |
||
descending |
boolean |
<optional> |
false |
|
columnType |
number |
<optional> |
HTMLTableWrapperUtils.COLUMN_TYPE_INFER |
|
- Implements:
- Source:
Members
columnIndex :number
Optional property indicating the index of the column this SortDescriptor
describes how to sort. If this property
is not a positive number, it will be assumed this SortDescriptor
describes how to sort entire rows.
Type:
- number
- Implements:
- Source:
columnType :number
How this column is to be sorted. If HTMLTableWrapperUtils.COLUMN_TYPE_INFER, will attempt to convert values to numbers prior to running the sort comparison; values that cannot be converted will be compared as strings, and will be sorted under those successfully converted to numbers. If HTMLTableWrapperUtils.COLUMN_TYPE_TEXT, all values will be compared as strings only.
Type:
- number
- Source:
Methods
compare(itemA, itemB) → {number}
Callback comparator function that compares one cell or row to another. If SortDescriptor#columnIndex is defined, and
a postiive number, HTMLTableCellElement
s in the approprite position within the rows being compared will be passed to this
function corresponding to this SortDescriptor
's SortDescriptor#columnIndex property, otherwise the HTMLTableRowElement
s
undergoing comparison will be passed.
If this function returns a value greater than 0, the relevant row corresponding to the first given item will be sorted below the second, if a value less than 0, the first will be sorted above the second, and if 0, no preference will be applied.
Parameters:
Name | Type | Description |
---|---|---|
itemA |
HTMLCellElement | HTMLTableRowElement | Reference cell or row. |
itemB |
HTMLCellElement | HTMLTableRowElement | Compare cell or row. |
- Implements:
- Source:
Returns:
A value greater than 0 if itemA
should be sorted below itemB
, less than 0 for above, 0 for no preference.
- Type
- number