Jump to:

5542 Posts in 1739 Topics by 1225 members

Customising the CMS

SilverStripe Forums » Customising the CMS » MemberTableList adding fields (updateSummaryFields)

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

Page: 1
Go to End
Author Topic: 1752 Views
  • CodeGuerrilla
    Avatar
    Community Member
    105 Posts

    MemberTableList adding fields (updateSummaryFields) Link to this post

    I am trying to add a dropdown populated by another dataobject (Company) to the MemberTableList (Security Tab)

    The DataObjectDecorator:

    class Customer extends DataObjectDecorator {
       
       static $summary_fields = array(
          'CompanyID' => 'Company'
       );
       
       function extraDBFields() {
          return array(
             'has_one' => array(
                'Company' => 'Company'
             )
          );
       }
       
       public function updateCMSFields(FieldSet &$fields) {
       
          $companies = DataObject::get("Company")->toDropdownMap('ID', 'CompanyName');
          $fields->push(new DropdownField("CompanyID", "Company", $companies));
    }

    public function updateSummaryFields(&$fields)
    {
          $companies = DataObject::get("Company")->toDropdownMap('ID', 'CompanyName');
          $fields->push(new DropdownField("CompanyID", "Company", $companies));
    }
    }

    The Company dropdown is added to to the popup and works fine but I can not get it added to the tablelist what am I doing wrong?

    Any help much appreciated!!!

  • CodeGuerrilla
    Avatar
    Community Member
    105 Posts

    Re: MemberTableList adding fields (updateSummaryFields) Link to this post

    If one of the dev's could comment on this would be much appreciated there is no clear example I can find doing this seeing that MemberTableField::addMembershipFields is deprecated an also will not let you change the field types this would be really handy I am willing to write a tutorial on this for the wiki if I can get this working.

  • smallstudio
    Avatar
    Community Member
    7 Posts

    Re: MemberTableList adding fields (updateSummaryFields) Link to this post

    I've got a number of sites with this issue now, does anyone have any documentation on how to add a field to the MemberTableList now that MemberTableField::addMembershipFields has been deprecated for 2.4?????

  • purplespider
    Avatar
    Community Member
    81 Posts

    Re: MemberTableList adding fields (updateSummaryFields) Link to this post

    Did we manage to find out how to do this? Adding fields to the Member Table field that is.

  • chillburn.com.au
    Avatar
    Community Member
    12 Posts

    Re: MemberTableList adding fields (updateSummaryFields) Link to this post

    You need to use Object::add_extension to extend the Member class and then you use the updateSummaryFields function.
    There is a bit more of a detailed explanation here:
    http://chillburn.com.au/blog/adding-summary-fields-to-the-membertablelist-using-silverstripe-2-4/

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