Jump to:

23368 Posts in 18145 Topics by 2863 members

General Questions

SilverStripe Forums » General Questions » ComplexTableField.php (line 596)

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 341 Views
  • Schippie
    Avatar
    Community Member
    28 Posts

    ComplexTableField.php (line 596) Link to this post

    I am not sure where i am suppost to post this, but when i went through the book(Silverstripe the complete guide to CMS development) i ran into an error. The return function: public function dataObj() in ComplexTableField.php has a error.

    ClassInfo::baseDataClass(Object::getCustomClass($this->ctf->sourceClass())), $tis->itemID);

    Which should be $this, though i also read this is a deprecated function so i am not sure how important it is.

  • swaiba
    Avatar
    Forum Moderator
    1784 Posts

    Re: ComplexTableField.php (line 596) Link to this post

    Hi Schippie,

    Welcome to the forums!

    Can you please confirm as to which exercise from the book and which version of silverstipe you are using?

  • Schippie
    Avatar
    Community Member
    28 Posts

    Re: ComplexTableField.php (line 596) Link to this post

    Its part 5.4.1 and 5.4.2 which go into detail about the ComplexTableField. When you are then returning a function with i believe it was:

    function getCMSFields()
       {
          $fields = parent::getCMSFields();
          $jobsTable = new ComplexTableField(
             $this,
             'Jobs',
             'Job'
          );
          $fields->addFieldToTab('Root.Jobs', $jobsTable);
          return $fields;
       }

    Or it was:

    function getCMSFields()
       {
          $fields = new FieldList(
             new TextField('Title', 'Job Title'),
             new TextAreaField('Description', 'Job Description'),
             new TextField('Location', 'Location'),
             new DateField('ExpiryDate', 'Expiry Date')
          );
          return $fields;
       }

    Though i have change new FieldSet to new FieldList (to be inline with the documentations).
    And i was using silverstripe 3.0.5

  • swaiba
    Avatar
    Forum Moderator
    1784 Posts

    Re: ComplexTableField.php (line 596) Link to this post

    ComplexTableField has been replaced by GridField in silverstripe 3+

    I think Ingo said there is a module for use of this in 3+ but it isn't in the core code anymore

  • Schippie
    Avatar
    Community Member
    28 Posts

    Re: ComplexTableField.php (line 596) Link to this post

    Would explain the bug in the code. What are the key differences between gridfield and complextablefield in terms of implementation?
    Also in the context of the book that is. Seeing as the docs page about gridfields seems to point at the fact that a gridfield no longer is in the page extend but in the page controller extend?

  • swaiba
    Avatar
    Forum Moderator
    1784 Posts

    Re: ComplexTableField.php (line 596) Link to this post

    What are the key differences between gridfield and complextablefield in terms of implementation?

    Too many to list here, but the changes are massive and AFAIK for the better.

    Also in the context of the book that is. Seeing as the docs page about gridfields seems to point at the fact that a gridfield no longer is in the page extend but in the page controller extend?

    I'm not sure what book you mean, if you mean Ingo's SS book then you'll have to use a 2.4.x version, I suggest...
    http://www.silverstripe.org/assets/releases/SilverStripe-cms-v2.4.10.tar.gz

  • Schippie
    Avatar
    Community Member
    28 Posts

    Re: ComplexTableField.php (line 596) Link to this post

    Hmm , needing to use an oudated version to be inline with the book would be a bad idea. Will just have to read up through the documentation of GridFields. And see if there are examples of the implementation floating around the internet then.

    http://doc.silverstripe.org/framework/en/tutorials/5-dataobject-relationship-management

    will do what i need for the information part

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