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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

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

SS3: CMS Admin Header is displayed twice


Go to End


2 Posts   1453 Views

Avatar
juergr

Community Member, 17 Posts

25 July 2012 at 9:50am

Edited: 27/07/2012 9:22am

OK, let's go straight to the problem...

I have a page with this code (simplified):

class AreaHolder extends Page {    
  static $has_many = array(
        'Areas' => 'Area'
    );
    
    function getCMSFields() {
        $fields = parent::getCMSFields();
        
        $grid_Config = GridFieldConfig_RecordEditor::create();
        $grid_Config->getComponentByType('GridFieldDataColumns')
                ->setDisplayFields(array(
                    'Title' => 'Name',
                    'RouteCount'    => 'Anzahl Routen'
                ));
        
        $fields->addFieldToTab('Root.Klettergebiete', 
                new GridField('Klettergebiete', 'Klettergebiete', $this->Areas(), $grid_Config));
        return $fields;
    }
}

class AreaHolder_Controller extends Page_Controller {    
}

And the Area DataObject which looks like this (simplified):

class Area extends DataObject {    
    static $db = array(
        'Title'  => 'Varchar(255)'
    );
    
    static $has_one = array(
        'Page'  => 'AreaHolder'
    );
    
    static $has_many = array(
        'Sectors'   => 'Sector',
        'SinglePitches' => 'SinglePitch',
        'MultiPitches'  => 'MultiPitch'
    );
    
    function getRouteCount() {
        return $this->SinglePitches()->Count() + $this->MultiPitches()->Count();
    }
    
    function getCMSFields() {
        
        $fields = new FieldList(
                new TabSet('Root',
                        new Tab('Main', 'Hauptteil'),
                        new Tab('SinglePitch', 'Einseillängen'),
                        new Tab('MultiPitch', 'Mehrseillängen')
                ));
        
        $fields->addFieldToTab('Root.Main', new TextField('Title', 'Name', $this->Title));
        $fields->addFieldToTab('Root.Main', new GridField('Sectors','Sektoren', $this->Sectors(), GridFieldConfig_RecordEditor::create();));
        $fields->addFieldToTab('Root.SinglePitch', new GridField('SinglePitches', 'Einseillängenrouten', $this->SinglePitches(), GridFieldConfig_RecordEditor::create();));
        $fields->addFieldToTab('Root.MultiPitch', new GridField('MultiPitches', 'Mehrseillängenrouten', $this->MultiPitches(), GridFieldConfig_RecordEditor::create();));
        return $fields;
    }
}

In the attached images you can see that the Header of the CMS Admin gets duplicated as soon as i want to edit one item from the gridfield or create a new one. Editing/Creating works fine, but a click on the back button or one of the links in the Breadcrumb breaks the Admin Interface and the whole right part is just blank.

If added another picture "AreaAfterRefresh" which shows (in my opinion) the correct Header. This Header is displayed if i reload the page with [F5] to my browser. After that, the back button and the links are working fine.

What am I doing wrong? Or is this a Bug?

Attached Files
Avatar
juergr

Community Member, 17 Posts

26 July 2012 at 8:24pm

I still have no solution for this. is out there someone with the same problem?