Jump to:

5541 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » SS_Report + getReportField

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 939 Views
  • IOTI
    Avatar
    Community Member
    189 Posts

    SS_Report + getReportField Link to this post

    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

    939 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.