Hi,
i am still working on an old problem. I have set up a gridfield for a many_many relation. Everything works fine, but if i want to "change relation status", the gridfield shows all items from page_mitarbeiter instead of mitarbeiter.
http://stackoverflow.com/questions/19094863/multiple-rows-with-same-id-in-silverstripe-gridfield
private static $many_many = array (
'Mitarbeiter' => 'Mitarbeiter'
);
private static $many_many_extraFields = array(
'Mitarbeiter' => array(
'SortOrder' => "Int"
)
);
$MitarbeiterFieldConfig = GridFieldConfig::create(200)->addComponents(
new GridFieldToolbarHeader(),
new GridFieldSortableHeader(),
new GridFieldDataColumns(),
new GridFieldDeleteAction('unlinkrelation'),
new GridFieldSortableRows('SortOrder'),
new GridFieldManyRelationHandler(), 'GridFieldPaginator'
//new GridFieldPaginator(20)
);
$MitarbeiterField = new GridField("Mitarbeiter", "zuzuordnede Mitarbeiter", $this->Mitarbeiter(), $MitarbeiterFieldConfig);
$fields->addFieldToTab('Root.Mitarbeiter', $MitarbeiterField);
public function Mitarbeiter() {
$mitarbeiter = $this->getManyManyComponents('Mitarbeiter')->sort('SortOrder');
return $mitarbeiter;
}
Can anybody help?