futurity
Joined: 07 Jan 2009
Posts: 4
Posted: 2009-01-07 13:13
Back to top
Reply with quote
|
I'm using a simple table lookup, but although I've tried many different methods I can't work out how to sort using the id number rather than the looked up name.
I currently have a field "end_month" that contains an index to the id field in the months table:
$opts['fdd']['end_month'] = array(
'name' => 'End month',
'select' => 'T',
'maxlen' => 11,
'sort' => true
);
To display the month name rather than the id I use the following code:
$opts['fdd']['end_month']['values']['table'] = 'months';
$opts['fdd']['end_month']['values']['column'] = 'id';
$opts['fdd']['end_month']['values']['description'] = 'long_name'; // optional
However it sorts alphabetically on the month name, not on the id stored in the field. It make no difference if I set sort to false. The months and there iIDs are:
1, Jan
2, Feb
etc
But Apr (April) always appears first in the list.
Any help would be much appreciated,
Regards
Neil
|
doug
Joined: 10 Feb 2003
Posts: 1013
Location: Denver, Colorado (USA)
Posted: 2009-01-07 14:17
Back to top
Reply with quote
|
See the 'orderby' option under "Complex table lookup example" at
http://opensource.platon.sk/projects/doc.php/phpMyEdit/html/configuration.input-restrictions.html#AEN963
|
|
Post new topic
Reply to topic
|
|
|