Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

HasManyDataObjectManager no CSS


Reply


4 Posts   615 Views

Avatar
ismooth

Community Member, 24 Posts

27 September 2012 at 1:31am

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

Avatar
ismooth

Community Member, 24 Posts

27 September 2012 at 2:56am

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?

Avatar
UncleCheese

Forum Moderator, 4096 Posts

16 October 2012 at 3:53pm

You can't use TabSets in a DOM popup.

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

Avatar
ismooth

Community Member, 24 Posts

16 October 2012 at 10:29pm

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?