Hi,
I have amended the CMS form for one of my pages to include a TableListField.
This works fine, it shows the 4 columns I have asked it to show for the records in table ProgrammeLaunch.
However, it is ignoring my custom query that is set for the CSV export (ie on the form I show just 4 fields, but in the CSV export I want to see more fields, but only the 4 fields listed for the form view are being exported. Here is the code:
class ProgrammeLaunchPage extends Page
{
static $db = array();
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Responses',$this->getProgrammeLaunchAnswersAsTLF());
return $fields;
}
/**
* Returns the questionnaire answers as a TableListField
*
* @return TableListField
*/
protected function getProgrammeLaunchAnswersAsTLF() {
// Fields to display at the top level
$fieldList = array(
'AttendeeName' => 'Name',
'AttendeeJobTitle' => 'Job Title',
'AttendeeCompany' => 'Company',
'LastEdited' => 'Submitted',
);
$tf = new TableListField('Responses', 'ProgrammeLaunch', $fieldList);
$tf->setFieldCasting(array('LastEdited' => 'Date->Nice'));
// what is user allowed to do?
$tf->setPermissions(array('show', 'export', 'delete', 'print')); // export permission allows CSV exporting
//Page navigation
$tf->setShowPagination(true);
$tf->setPageSize(12);
// CSV output def
$customCsvQuery = new SQLQuery('*', 'ProgrammeLaunch', null, 'AttendeeName');
//die($customCsvQuery);
$tf->setCustomCsvQuery($customCsvQuery);
return $tf;
}
}
If I uncomment the die statement, the SQL produced is valid: SELECT * FROM ProgrammeLaunch ORDER BY AttendeeName
What am I missing?
Many thanks for any help