What if you are trying to sort by the "Attachment" instead of "Title". Since Attachment is part of the $has_one array instead of the $db array, it has no actual entry, but rather is represented by the "AttachmentID" field. How do I go about sorting by the actual attachment name?
class Resource extends DataObject
static $db = array (
'Name' => 'Text',
'Description' => 'Text'
static $has_one = array (
'Attachment' => 'File',
'ReportPage' => 'ReportPage'
static $default_sort = "AttachmentID ASC"; // Doesn't actually sort by Attachment name
public function getCMSFields_forPopup()
return new FieldSet(