This class is used to make a HTML Table sortable.
new SortableTable([oTable [, oSortTypes]])
Name | Type | Descripton |
oTable | HTMLTableElement | Optional. The table element that should be sortable |
oSortTypes | String[] | Optional. An array containing strings describing the sort types |
Name | Description | |||||||||
getInnerTextSyntax
Arguments
Return Type
| Returns the text inside the node and its subtree | |||||||||
basicCompareSyntax
Arguments
Return Type
| Takes two values and compares them using < and returns -1 if the first one is smaller, +1 if the second one is smaller or 0 if they are equal. | |||||||||
idFunctionSyntax
Arguments
Return Type
| This just returns the first argument | |||||||||
toUpperCaseSyntax
Arguments
Return Type
| Takes a string and returns it in upper case | |||||||||
toDateSyntax
Arguments
Return Type
| Takes an ISO date formatted string and returns a JS date object |
Name | Type | Descripton |
gecko | Boolean | True if the user agent is based on Gecko, the Mozilla rendering engine |
msie | Boolean | True if the user agent is based on Microsoft Internet Explorer |
removeBeforeSort | Boolean | If true then the table is removed while sorting. Some browser are faster when doing it this way. |
Name | Description | |||||||||||||||
addSortTypeSyntax
Arguments
Return Type
| Adds a sort type to all instance of SortableTable | |||||||||||||||
asyncSortSyntax
Arguments
Return Type
| Sorts the table asynchronously after the nColumns column. This method allows the current JS thread to finish before the actual sorting begins. This allows the UI to be updated before the sort. | |||||||||||||||
destroySyntax
Arguments
Return Type
| Destroys the object. This breaks all references between the DOM and the JavaScript object | |||||||||||||||
destroyCacheSyntax
Arguments
Return Type
| Destroys the cache data. This breaks all references between the array and the DOM | |||||||||||||||
getCacheSyntax
Arguments
Return Type
| Returns an array containing the data to sort the table after | |||||||||||||||
getRowValueSyntax
Arguments
Return Type
| Returns the value for this row when sorting the table using the sType type and the nColumn column | |||||||||||||||
getSortFunctionSyntax
Arguments
Return Type
| Returns the function used to compare two items in the data cache array | |||||||||||||||
getSortTypeSyntax
Arguments
Return Type
| Returns a string representing the type to sort the column after | |||||||||||||||
getValueFromStringSyntax
Arguments
Return Type
| Casts a string to the data type used for the comparison in the sort method | |||||||||||||||
headerOnclickSyntax
Arguments
Return Type
| Called when the user clicks on a table header cell | |||||||||||||||
initHeaderSyntax
Arguments
Return Type
| Initiates the header cells with event listeners and arrow images | |||||||||||||||
removeSortTypeSyntax
Arguments
Return Type
| Removes a sort type from all instance of SortableTable. Be careful not to remove a type that is needed by some instances of SortableTable. | |||||||||||||||
setSortTypesSyntax
Arguments
Return Type
| Sets the types to use to sort the different columns by. | |||||||||||||||
setTableSyntax
Arguments
Return Type
| Sets the table element to use for the sortable table. This in turn calls setTHEad and setTBody using the table head of the table and the first table body of the table. | |||||||||||||||
setTBodySyntax
Arguments
Return Type
| Sets the table body element to use for the sortable table. | |||||||||||||||
setTHeadSyntax
Arguments
Return Type
| Sets the table head element to use for the sortable table. This adds click event handlers to the cells for the table header. It also adds sort arrows as needed to these cells. | |||||||||||||||
sortSyntax
Arguments
Return Type
| Sorts the table after the nColumns column | |||||||||||||||
uninitHeaderSyntax
Arguments
Return Type
| Used to clean up the header when the object is destroyed | |||||||||||||||
updateHeaderArrowsSyntax
Arguments
Return Type
| Updates the class names for the header arrow images to reflect the current sort state |
Name | Type | Descripton |
descending | Boolean | Read only. Whether the currently sorted column is sorted descending. Null if no column is sorted. |
document | Document | Read only. The document where the table resides |
element | HTMLTableElement | Read only. The HTML table used with this object |
sortColumn | Number | Read only. The currently sorted column. Null if none. |
tBody | HTMLTableBodyElement | Read only. The table body of the table |
tHead | HTMLTableHeadElement | Read only. The table head of the table |
Name | Descripton |
onbeforesort | Called before the table is sorted |
onsort | Called after the table is sorted |
None.