I fought with this one for a while too!
Not sure if it's the best way, but I found that I could create an additional "virtual" field to display the link. Similar to your example I had a table with an integer id field that I joined to another table using the ['values'] option. I never could find a way to get the integer id for the URL link. In list mode I chose to display the joined data as one column then created the next column to read "EDIT" or whatever. Using the ['sql'] command to create in essence a duplicate copy of the id field without the ['values'] join, the $value variable had the correct integer id needed for the link.
Example:
Kód: |
$opts['fdd']['uid'] = array(
'name' => 'Assigned User',
'select' => 'T',
'maxlen' => 20,
'default' => '0',
'sort' => true,
'values' => array(
'table' => 'users',
'column' => 'uid',
'description'=> array(
'columns' => array(
'0' => 'lname',
'1' => 'fname',
'2' => 'mname',
'3' => 'auth_name'
),
'divs' => array(
'0' => ', ',
'1' => ' ',
'2' => ' -- '
),
),
'orderby'=>'lname'
)
);
$opts['fdd']['edit_link'] = array(
'name' => 'Edit User Information',
'select' => 'T',
'options' => 'L',
'maxlen' => 20,
'default' => '0',
'sort' => false,
'sql' => 'PMEtable0.uid', // This was in a tabbed/subform environment. You might just use 'uid'
'URL' => 'users.php?User_fl=0&User_fm=0&User_sfn[0]=0&&oper=list&User_operation=PME_op_Change&User_rec=$value',
'URLdisp' => 'Edit User'
);
|
There may be better ways, but this worked for me.
|
Thank you Phredbroughton,
I will try your version. It looks promissing.
Kind regards,
Ben
phredbroughton Napísal: |
I fought with this one for a while too!
Not sure if it's the best way, but I found that I could create an additional "virtual" field to display the link. Similar to your example I had a table with an integer id field that I joined to another table using the ['values'] option. I never could find a way to get the integer id for the URL link. In list mode I chose to display the joined data as one column then created the next column to read "EDIT" or whatever. Using the ['sql'] command to create in essence a duplicate copy of the id field without the ['values'] join, the $value variable had the correct integer id needed for the link.
Example:
Kód: |
$opts['fdd']['uid'] = array(
'name' => 'Assigned User',
'select' => 'T',
'maxlen' => 20,
'default' => '0',
'sort' => true,
'values' => array(
'table' => 'users',
'column' => 'uid',
'description'=> array(
'columns' => array(
'0' => 'lname',
'1' => 'fname',
'2' => 'mname',
'3' => 'auth_name'
),
'divs' => array(
'0' => ', ',
'1' => ' ',
'2' => ' -- '
),
),
'orderby'=>'lname'
)
);
$opts['fdd']['edit_link'] = array(
'name' => 'Edit User Information',
'select' => 'T',
'options' => 'L',
'maxlen' => 20,
'default' => '0',
'sort' => false,
'sql' => 'PMEtable0.uid', // This was in a tabbed/subform environment. You might just use 'uid'
'URL' => 'users.php?User_fl=0&User_fm=0&User_sfn[0]=0&&oper=list&User_operation=PME_op_Change&User_rec=$value',
'URLdisp' => 'Edit User'
);
|
There may be better ways, but this worked for me. |
|