Default column sorted using class="aui aui-table-sortable"

I’m using Atlassian’s AUI library, and it’s brilliant so far. Except, I seem to be missing how to set a default column to sort on for a table using class="aui aui-table-sortable". I’ve tried setting the following, but I still seem to be missing something:

``$(document).ready(function() {
    $("#tradesTable").aui.tablesorter( { sortList: [[0,0]] });
});

Docs (https://docs.atlassian.com/aui/7.6.1/docs/sortable-table.html) state that sortable tables are experimental. This might be related to the AUI version you’re on. Which one are you using? Also, which version of Jira are you building against?

If the version you’re using does not have sortable tables, you can also manually pop the JS library into the main resource folder, then register it as a resource in your descriptor.

It’s not in the core. So you’ll need to explicitly add it as a dependency in your web-resources declaration, something like:


  <web-resource key="Sample-resources-url" name="Sample Web Resources">
    <dependency>com.atlassian.auiplugin:ajs</dependency>
    <dependency>com.atlassian.auiplugin:aui-table-sortable</dependency>
    <resource type="download" name="my-js.js" location="/js/my-js.js"/>

    <context>my-context</context>
  </web-resource>

(the <dependency>com.atlassian.auiplugin:aui-table-sortable</dependency> is the important snippet here).

The link the @nmansilla gave has the availability status in the top of the document (some are in ‘core’, some like this one - are not).

Sortable-table has been out of experimental since 5.8+ (which is what all “modern” Atlassian products are using - see https://bitbucket.org/atlassian/aui-adg/wiki/versions/product-version-matrix ).

1 Like