3070 Posts in 869 Topics by 651 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2186 Views |
-
Reverse order of a DataObjectSet()

19 February 2009 at 5:40am
Hey,
I'd like to reverse the order of DataObjectSet() as I'm using it for search results and it returns the pages ascending order of creation rather than descending.http://api.silverstripe.org/sapphire/model/_sapphire---core---model---DataObjectSet.php.html
mentions a sort function but I'm not sure if its what im looking for
and great cms and thanks for all the help in the past btw
-
Re: Reverse order of a DataObjectSet()

19 February 2009 at 12:51pm
You can do this inside your DataObject::get() call. The sort parameter is the 3rd one - eg DataObject::get('Page','','Created DESC');
You can also use that sort you mentioned. $myDataObjectSet->sort('Created', 'DESC');
-
Re: Reverse order of a DataObjectSet()

21 February 2009 at 6:20am
Thats great, thought it would be something simple
thanks will!
| 2186 Views | ||
|
Page:
1
|
Go to Top |


