Saving table sorting?

I'd like to save the sorting I apply to a table in the Wiki; is this possible?

4 answers

I don't think so, but using the Table-plus macro you can specify an auto sort column so that it always initially shows with that column sorted ascending or descending.

Bummer, that doesn't really help. Since I have to edit the table in the Editor, I really need sorting in there, if anywhere...

Hey Mason,

I would say, that this is possible by writing a plugin:

  • Javascript tracks the re-sorting
  • per REST-API writes that back on the server (for example as an additional class to the correpsonding th-tag.
  • Javascript scanns tables for additional class and sortes it accordingly.

Would you like this bahaviour for all tables or just selected ones?

This is a very old question ... but it still came up when I was searching.  Yes, Confluence tables now (by default) support column sorting by the reader ... but sometimes (as the author) you want to permanently save the table pre-sorted so that it always comes up a certain way.

It is possible to do this if you have access to a text editor that will let you replace newline and tab characters (regular-expressions).  I have a Mac, and I opened a Unix terminal and used sed for this purpose.

  1. Open the page with your table, and sort it the way you want  (click on the column heading you want to sort by).
  2. Highlight the contents of the table and Copy.
  3. Open a text editor and paste (I used vi on Unix).  This will save a text file with embedded tabs between the columns.
  4. Use your editor to replace newlines and tabs with the vertical bar character.  (I used the following sed command on my text file, ttt.txt.)

    sed -e $'s/\t/|/g' -e 's/^/|/' ttt.txt

    (Note: That '$' is a Mac thing ... you may not need it.)
  5. Either save the output to a file or (if not very long) just display it in the terminal window ... and Copy the output.
  6. In the Confluence editor, insert Markup, and paste the copied text.  This will create a new table, sorted as you want.

Suggest an answer

Log in or Join to answer
Community showcase
Maarten Cautreels
Posted Thursday in Off-topic

Friday Fun: What's your favourite beer/drink

As a Belgian, beer-lover and home brewer, beer is one of my great passions. I love the fact that with just a few ingredients (usually just water, hop and malt) you can create so many different tastes...

286 views 38 9
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot