Jump to:

3462 Posts in 1065 Topics by 740 members

Data Model Questions

SilverStripe Forums » Data Model Questions » many_many relationship - delete row in tablelistfield

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1547 Views
  • ib
    Community Member
    2 Posts

    many_many relationship - delete row in tablelistfield Link to this post


    I would like to organise persons and countries, which are both DataObjects, with modeladmin. One person is eligible to work in many countries and countries relate to many persons eligible to work in it.

    In the CMS I add eligibility countries with a dropdownfield in person class getCMSFields() to the many_many relation.

    To list all countries a person is eligible to work with tablelistfield in the CMS works fine. But my problem is to delete a row in the table. I tried to delete rows in the tablelistfield with the delete permission. Unfortunately the country object will be deleted and not just the relation between person and country.

    Does anybody know how to delete just the relation with a button or link in the tablelistfield??


  • baba-papa
    Community Member
    279 Posts

    Re: many_many relationship - delete row in tablelistfield Link to this post

    With the method getCMSFields_forPopup() you can define how your popup field for a single entry in the ComplexTableField looks like. I would display the country as a CheckboxSetField.
    This tutorial can help: http://doc.silverstripe.org/doku.php?id=tutorial:5-dataobject-relationship-management&s=getcmsfields%20forpopup

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.