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?