How to show attachment URL

I have a field for the file upload and want to show this column in the list view(show all) with the linkable URL of the attachment, so the attachment will be automatically opened in the browser when the cell in the attachment column is clicked. FYI, the database table only stores the file name of the attachment.
I have wrote a renderCell function in the delegate class like following, but it doesn't work because the URL is incorrect:
Is there any way to show the actual URL of the attachment without hard-coding with /tables/table_name/field_name/cell_value, just as how xataface handle the attachment in browse mode?
I have wrote a renderCell function in the delegate class like following, but it doesn't work because the URL is incorrect:
- Code: Select all
function reference_attachment__renderCell(&$record){
if ($record->val('reference_attachment') == NULL){
return $record->strval('reference_attachment');
} else {
return '<a href="'.$record->strval('reference_attachment').'">'.$record->strval('reference_attachment').'</a>';
}
}
Is there any way to show the actual URL of the attachment without hard-coding with /tables/table_name/field_name/cell_value, just as how xataface handle the attachment in browse mode?