Removing a relation in a GridField

60 views
Skip to first unread message

baba-papa

unread,
Oct 5, 2012, 9:53:42 AM10/5/12
to silverst...@googlegroups.com
The GridFieldAddExistingAutocompleter helps making relation between objects. I would expect the scaffolded the GridField to offer a button to remove relations but there is only a button to delete the whole object. Is there a solution for this issue?

Further I suggest that objects may only be deleted in their own ModelAdmin for security reasons.

Ingo Schommer

unread,
Oct 5, 2012, 10:42:54 AM10/5/12
to silverst...@googlegroups.com
Hello Roland!

On Friday, October 5, 2012 3:53:42 PM UTC+2, baba-papa wrote:
The GridFieldAddExistingAutocompleter helps making relation between objects. I would expect the scaffolded the GridField to offer a button to remove relations but there is only a button to delete the whole object. Is there a solution for this issue?
To quote the PHPDoc for the class ;)
Often used alongside {@link GridFieldRemoveButton} for detaching existing records from a relationship.
Incidentally, that's the wrong class name, should be GridFieldDeleteAction - which I've just fixed. 
  

Further I suggest that objects may only be deleted in their own ModelAdmin for security reasons.
That might be useful in your context, but others will want to provide full edit/delete
capabilities in different "views", one of which can be a ModelAdmin.
There's no concept of "an object's own ModelAdmin" in core,
you can have the same object editable through GridFields in other places,
even through multiple ModelAdmins. I would suggest you simply don't add the 
GridFieldDeleteAction component to views where you want to avoid deletion,
and leave global permission management to canDelete().

Ingo
Reply all
Reply to author
Forward
0 new messages