How to get a reverse sort order in the page tree?
Asked by Vigfus Andersson:

Hi,

On the actual page, Retro \& Backlogprio, I've tested the macros Children UI and Page tree to reverse the sort order (descending) for our pages with meetings. The problem is that it will only affect the actual page (see pic below) and the sort order in the page tree is till ascending.

I don't want to sort the whole page tree in descending order - only the specific displays under each sub page in the page tree (where you see the bottom pointing arrows to the left) so they match the sort order on the actual page (with the top pointing arrow to the right). Is there any way to do that?

Best Regards,  
Vigfus

![pageTreeSelectiveSort.PNG](/t5/image/serverpage/image-id/32739i4C116A3F5D2377FD/image-size/large?v=v2&px=999 "pageTreeSelectiveSort.PNG")


Answers:
author: Shane Cyr
body: I'd like to +10 this request for a reverse sort option. This seems like a challenging thing to consider, I've drafted this comment like four times after hitting corners where I realize it's complex to manage (and presumably to develop). One suggestion might be to let us configure a setting on a *page* that tells the tree to use a particular sort for its children in the tree. So there wouldn't need to be ultra-powerful, overly complex tree configuration, it would instead adopt its instructions from the pages it links to.

Thanks!


author: Shawn C
body: Hi Vigfus,

Currently, the Sidebar Page Tree only has the sorting options of Manual or A-Z and there is a Feature Request to bring in a 'reverse' Z-A Sort option to it: <https://jira.atlassian.com/browse/CONFSERVER-31358>

As a possible workaround, you could [add the following CSS](https://community.atlassian.com/t5/Confluence-questions/Re-Sorting-order-of-child-pages-in-Confluence/qaq-p/404402/comment-id/68439#M68439) to the Space Style Sheet to reverse the Sidebar Page Tree, however it'll reverse everything in the tree:

```
.plugin_pagetree_children_list{
 display:flex;
 flex-direction:column-reverse;
}
```

Looking at the [Community Post](https://community.atlassian.com/t5/Confluence-questions/Sorting-order-of-child-pages-in-Confluence/qaq-p/404393) where I found this CSS on, the creator does mention a way to specify sorting certain sections of the Page Tree by pulling the IDs of Parent Pages; it might be something to try if you only need to sort the Child pages of "Retro" and "Ovriga".

Cheers,   
Shawn

comments: author: Vigfus Andersson
body: Thanks for the informative reply Shawn!

Best Regards,  
Vigfus


author: Matthew Beda
body: This uses the ++*Refined Theme*++ Plugin **Page Tree** but should be able to modify it for the Stock **Page Tree** Macro.

User Macro to Specify individual Menu Item based on Title Attribute;

```
## @param MenuItemText:title=Menu item Text to Reverse Sort|type=string|required=true|desc=Exact Match needed. Is case Sensitive.

<style>
.reversesort + .rw_pagetree_list {
display:flex;
flex-direction:column-reverse;
}
</style>
<script>
AJS.toInit(function() {
    ul = AJS.$("a[title='$paramMenuItemText']").parent().parent().addClass('reversesort');
    AJS.$('.rw_page_tree_wrapper').ajaxComplete(function() {
        ul = AJS.$("a[title='$paramMenuItemText']").parent().parent().addClass('reversesort');
    });
});
</script>
```