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.

General Questions /

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

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

When adding a page in the CMS I would like the page to appear at the top


Go to End


2 Posts   573 Views

Avatar
simples

Community Member, 77 Posts

11 September 2012 at 6:19am

Edited: 11/09/2012 6:03pm

Hi,

When I add a new page in the CMS, I would like the newly added page to go to the top of the list in the tree view. At the moment it goes to the bottom.

I have downloaded the DOM in which I see there is a SortableDataObject module. However I am looking for a lightweight solution and suspect that there is a lot of code in this module which is not needed for this particular issue.

Does anyone know of a lightweight solution?

Simply adding

static $default_sort = 'Sort DESC';

or

static $default_sort = 'ID DESC';

beneath the line

class Page extends SiteTree{

in mysite/code/page.php

does not appear to work after I rebuild the database and flush the CMS page.

The new page still gets added to the bottom.

I hope I do not have to instruct my client to drag and drop every page.

Apologies if I have overlooked something obvious here.

Thanks.

PS. I am using Version 2.4 because my client is stuck with hosting which only supports PHP 5.2.

Avatar
simples

Community Member, 77 Posts

11 September 2012 at 9:00am

Edited: 11/09/2012 6:04pm

Hi,

Please note that I am not looking for a different sort capability here as such. All I really want to do is make the newly added page in the CMS appear at the top of the existing list of pages rather than at the bottom. I still want to be able to use drag and drop in the CMS. As done currently, I need the pages in the front-end menus to appear in the same order as they appear in the back-end CMS treeview.

Thanks.