Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Can I get a normal html table on a Confluence page?

Eddie Connatser January 10, 2013

Every plain html table I create within a Confluence page using the html macro turns into a sortable table (by heading). Is there a way to stop this? I don't want the table to be sortable at all.

Thanks!
Eddie

4 answers

1 accepted

1 vote
Answer accepted
CharlesH
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 11, 2013

Hi Eddie,

The sortable behaviour is applied to the table because of the class "tablesorter" I think:

<table class="confluenceTable tablesorter">

Remove that class and the sorting options disappear. I've confirmed this with Firebug by removing that class on the fly.

Within Confluence my first attempt to do this relied on the following code being added to the page:

{html}
<script>
jQuery(document).ready(function(){
  jQuery('table.tablesorter').removeClass('tablesorter');
}); 
</script>
{html}

While this code executes without a problem, it would seem that the tablesorter class is applied dynamically to the tables, as both the class and the sorting behaviour are still on the tables (as shown by inspection with Firebug). This is not a great situation, as our dynamic code is fighting against the standard Confluence dynamic code (usually Confluence wins!).

If you have the Adaptavist Content Formatting plugin installed, then I'd opt for using the table macros as a quick fix. These will give you full control over the styles applied to the table, so you can simply not specify "tablesorter" as a class and all should be well.

Hope this helps,

Charles

Eddie Connatser January 14, 2013

Bob, Charles,

Thank you both for your replies! It is correct that the jquery code does remove the sorter class from the table, but the table is still sortable. I even tried removing the sortable classes from the table head <tr> and <th> tags since I noticed a sorter class applied to them as well. Still no luck.

Thanks again!

Kind regards,
Eddie

Jim Bethancourt
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 15, 2013

I was able to remove the confluenceTable and confluenceTd classes with similar code:

&lt;script&gt;
jQuery(document).ready(function(){
    jQuery('table.confluenceTable').removeClass('confluenceTable');
    jQuery('td.confluenceTd').removeClass('confluenceTd');
});
&lt;/script&gt;

1 vote
Daniel Berman February 11, 2014

One workaround to make it not sortable is to add a merged cell to the table.

1 vote
Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 11, 2013
0 votes
Andrew Plaisance April 29, 2016

Within an HTML macro:

&lt;script&gt;
jQuery(document).ready(function(){
 jQuery('table').toggleClass('tablesorter doNotSort');
});
&lt;/script&gt;

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events