5121 Posts in 1527 Topics by 1119 members
| Go to End | Next > | |
| Author | Topic: | 3595 Views |
-
ManyManyComplexTableField in Popup

7 April 2009 at 4:37am
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'
);
} -
Re: ManyManyComplexTableField in Popup

17 September 2009 at 4:39am
I have the same problem with the pop-up not working; the link to add opens right over top of the CMS.
Did you find a solution to the problem? Thank you!
-
Re: ManyManyComplexTableField in Popup

27 March 2010 at 5:20am Last edited: 27 March 2010 5:21am
Has anyone a solution for this yet? I've got the same problem here.
-
Re: ManyManyComplexTableField in Popup

27 March 2010 at 5:41am
You can get it work with CheckboxSetField!
function getCMSFields() {
$fields = parent::getCMSFields();
if($this->ID) {
$ergebnis = new CheckboxSetField(
'Empfaenger', 'Empfaenger',
DataObject::get('Endkunde', 'DepositaerID = "'.$this->Depositaer()->ID.'"' ),
$this->getManyManyComponents('Empfaenger') );
} else {
$ergebnis = new HeaderField("Empfänger können erst nach dem Speichern ausgewählt werden!", 3);
}
$fields->addFieldToTab('Root.Empfaenger', $ergebnis );
return $fields;
} -
Re: ManyManyComplexTableField in Popup

12 January 2011 at 2:49pm
Bump!
Ticking the checkboxes in a ManyManyComplexTablefield correctly saves a relationship as you would expect, provided that the ManyManyComplexTablefield is used outside of a popup.
But if the ManyManyComplexTablefield is _inside_ a popup, ticking the checkboxes then clicking 'Save' has no effect. The checkboxes revert to their previous state.
Anyone have a fix for this?
-
Re: ManyManyComplexTableField in Popup

10 February 2011 at 6:13am
Same problem here. ManyManyComplexTablefield doesn't save ticked items.
-
Re: ManyManyComplexTableField in Popup

12 February 2011 at 11:31am
Also have same issue with ManyManyComplexTableField in a popup. I'm attempting to use it in the popup when editing a member.
| 3595 Views | ||
| Go to Top | Next > |







