Chris:

Have you tried something like this:

<cfset imageIterator.getOrder().setAsc("image2gallery", "displayOrder")>

where displayOrder is your field in image2gallery table that contains the ordering data. After making this call, you should be able to use your iterator as normal.

Mark

Chris Blackwell wrote:

I'm trying to figure out if it's possible to sort the objects in an
iterator based on a field in a related table

Here is my xml config for the relevant objects.

                <object name="gallery" alias="Gallery">
                        <hasMany name="Image">
                                <link name="image2gallery"/>
                        </hasMany>
                </object>

                <object name="image" alias="Image">
                        <hasMany name="Gallery">
                                <link name="image2gallery"/>
                        </hasMany>

                </object>

                <object name="image2gallery">
                        <hasOne name="Gallery">
                                <relate from="gallery_id" to="id"/>
                        </hasOne>
                        <hasOne name="Image">
                                <relate from="image_id" to="id"/>
                        </hasOne>
                </object>

I want to be able to order the ImageIterator by a column in
`image2gallery` which defines the display order in the gallery and then
get my iterator back, is this possible?

Cheers, Chris



-- Reactor for ColdFusion Mailing List -- [email protected]
-- Archives at http://www.mail-archive.com/reactor%40doughughes.net/






-- Reactor for ColdFusion Mailing List -- [email protected]
-- Archives at http://www.mail-archive.com/reactor%40doughughes.net/


Reply via email to