Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » adding a HasManyComplexTableField to a popup

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 855 Views
  • Nivanka
    Avatar
    Community Member
    395 Posts

    adding a HasManyComplexTableField to a popup Link to this post

    I need to add a HasManyComplexTableField to a popup block,

    Can I do this?

    <?php

    class Concert extends DataObject{

       static $db = array(
          "Content" => "Text"
       );

       static $has_one = array(
          "Ticket" => "TicketsPage"
       );

       static $has_many = array(
          "Seats" => "Seat"
       );

       function getCMSFields_forPopup(){

          $fields = new FieldSet();

          $fields->push(new TextField( 'Content', 'Content' ));

          $tablefield = new HasOneComplexTableField(
             $this,
             'Seats',
             'Seat',
             array(
                'Content' => 'Content',
                'Price' => 'Price'
             ),
             'getCMSFields_forPopup'
          );
          $tablefield->setAddTitle('Seats');

          $fields->push($tablefield);

          return $fields;

       }
    }

    ?>

    this is my code

    855 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.