Saving table sorting?

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

4 answers

This widget could not be displayed.

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.
This widget could not be displayed.

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.

Table plus sorts auto-number rows like:

 

1

10

100

101

102

 

instead of 

1

2

3

4

....

 

How do I enforce the latter?

This widget could not be displayed.

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

This widget could not be displayed.

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?

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published yesterday in Marketplace Apps

The 7 hacks of highly successful automation

...there's anything I've learnt from working, it's that people are lazy! No offense to anyone reading this, but it's true and we can all admit it. The easier you make something for someone, the more...

245 views 0 13
Read article

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