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.

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

How to order "HasManyComplexTableField" elements

Go to End

3 Posts   1365 Views


Community Member, 130 Posts

15 July 2010 at 10:35am

Edited: 15/07/2010 10:40am

I'm trying to build a slideshow that allows it's images to be managed from the CMS instead of some other non-CMS way.

Using this tutorial on how to create a "quotes" object:

and this tutorial on object relationships:

I've been able to create a very nice slideshow class that uses a ComplexTableField to retrieve a list of images.

However, I don't understand how to order my images other than the default order of creation. For each image in my ComplexTableField I've included a field in the cms to enter a number. The plan here is to use that number as a weight to order the list. I'm looking for something like "Order by $SlideOrder ASC" or whatever the equivalent might be. ($SlideOrder is the name of the field I want to order by.)

E.g. Now my table looks like this and it displays in this order:

$Image - $SlideOrder
ImageA.jpg - 3
ImageB.jpg - 1
ImageC.jpg - 2

So they display 3, 1, 2. I'm trying to get them to display 1, 2, 3.



Forum Moderator, 5523 Posts

15 July 2010 at 11:19am

For adding sorting / ordering then you want to check out the DataObjectManager (DOM) module which adds this functionality and a bunch of other stuff.


Community Member, 130 Posts

15 July 2010 at 1:23pm

I do believe, that's what I'm looking for.