Sortable Tables adds on to the core Tables component, allowing the table to be sorted by the header row. Some custom sorting options are available.
|Included in AUI core?||Not in core You must explicitly require the web resource key.|
|Web resource key:||
|AMD Module key:||N/A|
|TEST-12||Cannot sort tables||2||Table sorting should be allowed|
|WIN-87||Issue Page doesn't load in IE||7||When loading issue page on IE it doesn't show|
|DRINK-7||Vending Machine is empty||1||Blocker|
After including the web resource for sortable tables you can very easily assign a table as being sortable. You must define the classes "aui" and "aui-table-sortable" to the table and also define the <thead> of the table. The sorting method is detected automatically if no class is defined in the header, however some custom sorting methods include:
To set a table as sortable you must pass a jQuery object for the table into the AJS.tablessortable.setTableSortable function. This table must have the "aui aui-table-sortable" classes.
Assigning a table as sortable multiple times can result in undefined behavior. For example if a sortable table is present on page load and then you assign it as sortable via the AJS.tablessortable.setTableSortable function it is unlikely to work as expected.