Jump to:

22972 Posts in 11596 Topics by 2824 members

General Questions

SilverStripe Forums » General Questions » Sorting items / data

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

Page: 1
Go to End
Author Topic: 611 Views
  • mexik
    Avatar
    Community Member
    13 Posts

    Sorting items / data Link to this post

    Hi,

    I have created special page like catalog with items in it but it'd like to sort them by date (newest on the top).
    In my site tree it looks like that:

    Catalog holder page |
    - item page / date 1996
    - item page / date 2001
    - item page / date 2010

    And i'd like to display those in a list sorted by date (newest on the top).
    Help please ...

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: Sorting items / data Link to this post

    I have no idea how to do this within the sitetree automatically (I know that you are able to manually re-order the pages).
    But if it is within a DataObject::get then you can specific the sort order.

    Possibly adding this to your page object would work - but as I said within the sitetree I don't know..

    $default_sort = 'Created DESC'; //order by created date - I assume this is what you mean by "Date"

    611 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.