Search code examples
coldfusioncfwheels

cfwheels nestedproperties sortorder


I'm trying to sort order records in nestedProperties of cfwheels. In nestedProperties, there is two records displayed in Create page. When I save these two records, the first record saved as id = 2 (as second record) and the second record saved as (id = 1). When I displayed these two records in Edit page, id 1 display first and id 2 display 2. What I want is I want to display id 2 as first and id 1 as second by DESC.


Solution

  • I think you can set the sort order directly by column name: so:

    users=model("user").findAll(
          include="addresses", order="users.lastname ASC, addresses.sortorder DESC");
    

    Not tried it though!