Jump to:

22977 Posts in 11806 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » ManyManyComplexTableField Without Edit/Delete/Add Options

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 1682 Views
  • Ryoken
    Avatar
    Community Member
    18 Posts

    ManyManyComplexTableField Without Edit/Delete/Add Options Link to this post

    I'm working with the e-commerce module, and one of the tasks I am trying to complete is allowing a Bundle of individual products to be sold as one unit.
    Where I'm getting stuck at is selecting the individual products to be in the bundle. My idea was to simply use a ManyManyComplexTableField to allow the selection of the products, and this for the most part works fine. The problem is I really don't want a user to be able to Edit the individual product from the bundle, or worse yet, delete the product rather than un-checking the box.

    Is there some way I can remove the View, Edit, Delete, and add buttons and functions from the field, while still allowing the user to check the box to select the ones they want ? I would be most thankful for any assistance.

  • kleampa
    Avatar
    Community Member
    4 Posts

    Re: ManyManyComplexTableField Without Edit/Delete/Add Options Link to this post

    you can try:

    $actionTablefield->setReadOnly('true');

  • Spambanjo
    Avatar
    Community Member
    14 Posts

    Re: ManyManyComplexTableField Without Edit/Delete/Add Options Link to this post

    $actionTablefield->setReadOnly('true'); did not work for me in Silverstripe 2.4.7.

    While it got rid of the "add / edit / delete" buttons, the relationships were not saved after submission.

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: ManyManyComplexTableField Without Edit/Delete/Add Options Link to this post

    You could remove the default created one - or modify the existed created one (I don't know the ecommerce code well - maybe if you post existing code it would help).

    something like this...

    $ctf = new ManyManyComplexTableField ($this,'MyObject','Floor',null,null,<some where clause>);
    $ctf->setPermissions(array('edit','show'));
    $fields->addFieldToTab("Root.MyObject", $ctf);

    1682 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.