问题
Normally there's only a unlink function for the entries in a many_many relation grid field. But that's messy.
How can I also add an delete option?
回答1:
you can use:
$config->addComponent(new GridFieldDeleteAction(false));
which will add a delete button. The false argument specify that it is a delete button not unlink. $config is your GridFieldConfig instance.
来源:https://stackoverflow.com/questions/19524951/silverstripe-3-1-many-many-relation-unlink-and-delete-entries