Display both sort icons on sortable table columns I'm using Drupal's theme table function to build a custom table.

All of the columns on my table are sortable. I would like to visually indicate that they are sortable by putting both an ascending and descending sort icon in the column header.

To indicate which sort is active, I would like to show only one icon, corresponding to the current sort (ascending or descending).

Here's what I have:



Here's what I want:



How can I accomplish this?

So far, the closest I've gotten is overriding theme_tablesort_indicator(), but this will only let me override the icon for the active sort. (Docs here)
I used some jQuery and CSS to accomplish this:


&lt;script&gt;
(function($) {
Drupal.behaviors.myBehavior = {
  attach: function (context, settings) {
    $("table th a").each(function(){
      if (!($(this).html().indexOf('&lt;img') &gt; -1)) {
        var current = $(this).text();
        $(this).html(current + '&lt;span class="sortable"&gt;&lt;img src="/misc/arrow-asc.png" style="margin-bottom:0" alt=""&gt;&lt;img src="/misc/arrow-desc.png" style="margin:0 -13px 11px 5px" alt=""&gt;&lt;/span&gt;');
      }
    });
  }
};
})(jQuery);
&lt;/script&gt;