Hello, Can I open a ManyManyComplexTableField in a Popup in CMS to administrate relations. I tried it but it doesn't work, if I click the "Save" button the selections in the Table are not saved. Here is my code:
<?php
class ArztPage extends Page{
static $has_many = array(
'Aerzte' => 'Arzt',
);
function getCMSFields() {
$fields = parent::getCMSFields();
$AerzteTable = new ComplexTableField(
$this, 'Aerzte', 'Arzt', null, null, "Arzt.ArztPageID = {$this->ID}");
$fields->addFieldToTab( 'Root.Content.Ärzte', $AerzteTable );
return $fields;
}
..........
class Arzt extends DataObject {
static $has_one = array(
'ArztPage' => 'ArztPage'
);
static $many_many = array(
'Vereinigungen' => 'Vereinigungen'
);
function getCMSFields() {
$fields = parent::getCMSFields();
// add categories tab..
$vereinTablefield = new ManyManyComplexTableField(
$this,
'Vereinigungen',
'Vereinigungen',
array( 'Name' => 'Name' )
);
$fields->addFieldToTab( 'Root.Main', $vereinTablefield );
return $fields;
}
}
.............
class Vereinigungen extends DataObject {
static $db = array(
'Name' => 'Varchar(255)'
);
static $has_one = array(
'Bild' => 'Image'
);
static $belongs_many_many = array(
'Aerzte' => 'Arzt'
);
}