Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

SiteTree Sort Order


Reply


4 Posts   431 Views

Avatar
Steeloctopus

Community Member, 4 Posts

21 February 2014 at 4:46pm

Hi

I have just started developing a Sliverstripe site using 3.1. I would like to modify the sort order of the site tree in the CMS,

I have a PeoplePage object and I would like to sort this object in the tree in alphabetical order.

All the other post explain how to do it in older versions can any body tell me how to do this in 3.1

thanks

Avatar
Willr

Forum Moderator, 5513 Posts

21 February 2014 at 8:58pm

It should be the similar approach in 3.1 as per older releases. For your peoplepage object define the $default_sort variable

private static $default_sort = "Title ASC";

Avatar
Steeloctopus

Community Member, 4 Posts

24 February 2014 at 12:36am

OK I added the line

private static $default_sort = 'Title ASC';

Into my PeoplePage object but that has had no effect to the order. It is still overwritten by SORT in the CMS SiteTree. I have flushed the cache as well but with no success. I still get this order:

Dominic underwood   
Anablee the king
Zoey fine
Joey Blogs

Where is should be
Anablee the king
Dominic underwood   
Joey Blogs
Zoey fine

Am I doing something wrong. If I change this line in the SiteTree object then the whole SiteTree order is effected.

private static $default_sort = "\"Title\"";

I'm must be doing something stupid. can anyone help?

Avatar
Willr

Forum Moderator, 5513 Posts

24 February 2014 at 7:47pm

Potentially a bug within SilverStripe. AFAIK that should work from a theory point of few. If you can reproduce the issue on a clean 3.1 install it would be good to report it as an issue on github.com/silverstripe so it can be triaged / resolved.