Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

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

MemberTableList adding fields (updateSummaryFields)


Go to End


5 Posts   3151 Views

Avatar
CodeGuerrilla

Community Member, 105 Posts

14 January 2010 at 3:40pm

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

Avatar
CodeGuerrilla

Community Member, 105 Posts

15 January 2010 at 12:11pm

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.

Avatar
smallstudio

Community Member, 7 Posts

2 June 2010 at 8:46pm

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

Avatar
purplespider

Community Member, 89 Posts

27 July 2010 at 10:31pm

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

Avatar
chillburn.com.au

Community Member, 12 Posts

11 December 2010 at 11:16pm

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/