Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » HasManyDataObjectManager no CSS

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 493 Views
  • ismooth
    Avatar
    Community Member
    21 Posts

    HasManyDataObjectManager no CSS Link to this post

    Hi,

    I have simple datamodel with one dataobject having has_many relation to other dataobject, and back reference using has_one. Problem is in CMS I get popup tab shown without CSS. Trying to view related object also shows in popup without any css.

    How to resolve this? I'm using DataObjectManager build from 2012-05-29 (still on SS 2.4).

  • ismooth
    Avatar
    Community Member
    21 Posts

    Re: HasManyDataObjectManager no CSS Link to this post

    I noticed that I need to have all relations connect using DataObjectManager objects. If I use only some, it breaks it up.

    Furthermore, nested DataObjectManager isn't working properly. Second popup shows below already showing popup.

    What might be the problem here?

  • UncleCheese
    Avatar
    4085 Posts

    Re: HasManyDataObjectManager no CSS Link to this post

    You can't use TabSets in a DOM popup.

    ---------------
    Silverstripe tips, tutorials, screencasts, and more. http://www.leftandmain.com

  • ismooth
    Avatar
    Community Member
    21 Posts

    Re: HasManyDataObjectManager no CSS Link to this post

    Hi UC,

    I've tried removing TabSets, but unfortunately it didn't help. Relevant code is as follows:

    class Article extends DataObject {
       public static $has_many = array(
          'Reviews' => 'Review'
       );

       function getCMSFields() {
    $f = parent::getCMSFields();
        $revManager = new HasManyDataObjectManager(
             $this,
             'Reviews',
             'Review'
          );
    $f->addFieldToTab('Root.Reviews', $revManager);
    return $f;
    }

    class Review extends DataObject{

       public static $has_one = array(
          'Article' => 'Article',
          'Owner' => 'Member'
       );
       
       public static $has_many = array(
          'Comments' => 'Comment'
       );
       function getCMSFields() {
        $f = new FieldSet();
       
    $manager = new DataObjectManager(
    $this, // Controller
    'Comments', // Source name
    'Comment', // Source class
          );
        $f->push($manager);
    return $f;
    }
    }

    class Comment extends DataObject {

       static $has_one = array(
          'Review'=>'Review',
    );
       public function getCMSFields() {
          return new FieldSet(
             new TextareaField('Content', 'Content'),
             new CheckboxField('Status', 'Status'),
             new FileIFrameField('ReviewReport','Review file')
          );
    }
    }

    It's pretty straightforward model, but I can't figure out why it isn't working. Any ideas?

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