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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

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

How to sort pages in the CMS sitetree by title, date etc


Go to End


7 Posts   2103 Views

Avatar
pinkp

Community Member, 182 Posts

20 March 2015 at 10:40pm

I'm looking for a working example of how to sort my pages in the sitetree by title by default. Ideally I only want to sort child pages of a certain type. In my case I want all my Gallery pages under the parent Portfolio to be sorted Alphabetically by their title.
This is for easy searching in the backend CMS as I know how to sort them in the template.

I have found these examples but not enough to work this out for SS3.1+

http://www.ssbits.com/tutorials/2011/custom-sorting-in-the-cms-sitetree/
https://github.com/silverstripe/silverstripe-cms/issues/848

Avatar
wmk

Community Member, 87 Posts

20 March 2015 at 10:59pm

maybe you want hide those pages from sitetree and use a Gridfield instead?

See this talk about catalog manager module

Avatar
pinkp

Community Member, 182 Posts

20 March 2015 at 11:10pm

They need to be displayed as their own pages on the front end.. Are you suggesting that I can control the current pages in a separate gridfield? Or to replace my multiple pages with a single gridfield? I have tried dataobjects as pages via model admin but this wasn't really what I was after and I only need this page sorting and everything would be perfect. Thanks

Avatar
Pyromanik

Community Member, 419 Posts

20 March 2015 at 11:18pm

Click the list icon in the top right when viewing the tree (just the tree, not a page edit form with the tree on the left) to switch to list view. Click 'Page Title' header to order by it.

Avatar
pinkp

Community Member, 182 Posts

20 March 2015 at 11:44pm

Thanks Pyromanik I was totally over complicated the idea.. However when I do as you've said the sort order doesn't change! It refreshes and the pages don't change their order... ?

Avatar
Pyromanik

Community Member, 419 Posts

20 March 2015 at 11:57pm

It does by default - at least in 3.1.6

Have you added some other config options to try and make this a thing perhaps?

Avatar
pinkp

Community Member, 182 Posts

21 March 2015 at 3:20am

its strange the filtering works so thats enough but the sort order does not... not sure what I've changed but nothing intentional that would effect page sorting.. thanks for your tip!