how to re-order a relationship

From: Erik Hatcher (eri..hatchersolutions.com)
Date: Wed Apr 27 2005 - 11:32:39 EDT

  • Next message: Erik Hatcher: "Re: <cgen> Ant task and makepairs attribute"

    Here's my model - a "page" has multiple "sections". Sections are user
    orderable, and I provide a user interface to move them around. My plan
    is to add an "order" integer column to the SECTION table.

    Initially the sections table would look something like this:

            id order
            1 1
            2 2
            3 3

    then a user chooses to move section 3 up one, so it'd look like this:

            id order
            1 1
            2 3
            3 2

    How are folks handling this type of thing? I don't see a way to
    specify an order for a relationship join, so how could I get the List
    from a page.sections() call to come back in "order" order?

    And how do you handle updating the database in this type of situation?
    I presume that I will simply swap "order" numbers on two different
    section objects when a move-up or move-down action happens.

    Thanks for your help.

            Erik



    This archive was generated by hypermail 2.0.0 : Wed Apr 27 2005 - 11:33:09 EDT