Hello
I'm trying to use getReportField to display a ComplexTableField but i'm having a very hard time figuring out how to do it.
<?php
/**
* An extension to {@link SSReport} that allows a user to view all, booked, and not booked reports
*/
/**
*Gets all Rental Requests
*
*/
class AllRentalRequestReport extends SS_Report {
function title() {
return 'All Rental Requests';
}
function description() {
return 'All Rental Requests';
}
function getReportField(){
$CTF = new ComplexTableField(
'BookingFormSubmission',
'All Rental Requests Report',
'BookingFormSubmission',
$fieldList = array(
'ID' => 'ID',
'FirstName' => 'First Name',
'LastName' => 'Last Name'
)
);
$CTF->setParentClass('BookingFormSubmission');
return $CTF;
}
}
?>
BookingFormSubmission is a class that has several fields, nothing more
<?php
/*
* Custom class used to process Booking request form
*/
class BookingFormSubmission extends DataObject {
static $db = array (
'FirstName' => 'Text',
'LastName' => 'Text',
'Email' => 'Text',
'PhoneNumber' => 'Text',
'ArrivalDate' => 'Text',
'DepartureDate' => 'Text',
'Guests' => 'Text',
'AdditionalQuestions' => 'Text',
'Booked' => 'Boolean'
);
}
?>
I can't get the ComplexTableField form to show up in the CMS. I believe I am doing something wrong with the ComplextableField constructor but just not sure how to make it work correctly. Any guidance would be nice.
I've already tried looking at
http://doc.silverstripe.org/complextablefield and http://doc.silverstripe.org/complextablefieldexamples but still confused.
Thank you