Simple Module, $foreign_keys and ORDER BY

edited December 2013 in Modules
Hi all

So, I have a simple module to show my records. It includes a $foreign_key = array('location'=>'locations_model') which correctly gives me a selection list in the form view for my 'locations' field.

By default, the selection list displays items alphabetically based the 'display_field' element from MY_fuel_modules:
$config['modules']['glossary_speciesreproduction_fecundity'] = array('module_name' => 'Locations', 'display_field' => 'locationTerm', 'default_col' => 'locationPlacement', 'default_order' => 'asc');

As you can see, I've defined in what order I want the locations listed. This works for the list_items() in locations_model but not for the 'location' selection list in my parent model - it displays in 'locationTerm' order.

How would I specify my form lookup to be ordered by a specific field?

TIA.

Comments

  • edited 4:25AM
    I needed to add this. If you pull down the latest version you can add an 'order' parameter like so:
    $foreign_key = array('location'=> array('app' => 'locations_model', 'order' => 'locationTerm asc'));
Sign In or Register to comment.