Jump to:

5542 Posts in 1739 Topics by 1225 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Sorting CMS SiteTree

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

Page: 1
Go to End
Author Topic: 1557 Views
  • Miroke
    Avatar
    Community Member
    9 Posts

    Sorting CMS SiteTree Link to this post

    I searched all Forum but couldn't find this answer.

    ---

    1º - When we click to create a new item in CMS, it automatically got created in the end of the list. This is really really bad when u got a bunch of articles and need to scroll down a lot to find it. Is there any way to the new item be created in the FIRST of the list, and not last?

    ---

    2º - I have been trying to use this command in some controllers:

    static $default_sort = "Created DESC";

    The main objective is just to sort a specific list i need.
    But it just brings no effect, tried to use Created, Title and others default rows... but never works (SilverStripe 2.4.4).

    So, i made the hard decision to force it in "_config.php" using:

    SiteTree::$default_sort = "Created DESC";

    OK, it works fine, but i got all the tree sorted.

    How can i do a specific sort in a specific page i need?

    ---

    I'm trying to avoid change SilverStripe core, always using its own parameters.
    Sorry my bad english guys, i'll would be grateful for your help.

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: Sorting CMS SiteTree Link to this post

    I have been trying to use this command in some controllers:

    It shouldn't be in the controller, this is a model level variable. So try setting public $default_sort = "Created DESC"; on your subclassed model.

  • Miroke
    Avatar
    Community Member
    9 Posts

    Re: Sorting CMS SiteTree Link to this post

    I made it, but $default_sort just don't work (and every topic says the same).
    The main objective is sort the CMS Tree, but the only way possible right now is editing "_config.php".

    Can you give a look?

  • Miroke
    Avatar
    Community Member
    9 Posts

    Re: Sorting CMS SiteTree Link to this post

    I just figured out there's no solution for truly sort the tree.

    So i used pter's magic module called "hidepages" ( http://www.silverstripe.org/customising-the-cms/show/11471?start=32#post293932 ) that can make your own rules to sort the list.

    I really think SilverStripe could use this options in "$defaults" but it can't yet.

    Hope this can help other people.

    1557 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.