Hi,
I have a Designer object with a many_many connection to Regions. I edit them throught the ModelAdmin.
I have rebuilt the Regions tab for a designer with this code I found on the forum
public function getCMSFields()
{
$f = parent::getCMSFields();
// rebuild the regions tab
$f->removeByName('Regions');
$regionsTablefield = new ManyManyComplexTableField(
$this,
'Regions',
'Region',
array('Title' => 'Title')
);
$regionsTablefield->setAddTitle('Regions');
$regionsTablefield->setPageSize('50');
$f->addFieldToTab('Root.Regions', $regionsTablefield);
return $f;
}
This works, but only when I have done the following:
1/ Saved the Designer object and then
2/ Reloaded the designers list by pressing the tab at the top fo the ModelAdmin and
3/ Reopened my Designer object
When I try to add Regions when I first create the Designer, the Regions aren't saved. When I simply open the Designer without refreshing the list (step 2), it won't save anymore, the loading animation on the button will keep running.