Saving table sorting?

Mason Foster
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 23, 2013

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

4 answers

1 vote
Fred Bunting August 8, 2017

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.
0 votes
AndreasS December 7, 2013

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?

0 votes
Mason Foster
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 30, 2013

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

0 votes
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.
October 24, 2013

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.

Myleen Bacarra
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 8, 2018

Table plus sorts auto-number rows like:

 

1

10

100

101

102

 

instead of 

1

2

3

4

....

 

How do I enforce the latter?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events