Jump to:

3460 Posts in 1064 Topics by 739 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: 1536 Views
  • ib
    Avatar
    Community Member
    2 Posts

    many_many relationship - delete row in tablelistfield Link to this post

    Hi!

    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??

    Thx,
    ib

  • baba-papa
    Avatar
    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

    1536 Views
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.