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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

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

$summary_fields in modelAdmin (2.4)


Go to End


2 Posts   827 Views

Avatar
nekranox

Community Member, 31 Posts

7 August 2012 at 10:34pm

Hey guys,

any ideas why my summary fields arent working? It's just displaying the default columns for the DataObject.

class Customer extends DataObject {
	
	public static $db = array(
        [...]
	);
	
	public static $indexes = array(
		'Email' => 'unique'
	);
	
	public static $has_one = array(
		'CustomerGroup' => 'CustomerGroup'
	);
	
	public static $summary_fields = array(
		'Name' => 'Name',
		'Telephone' => 'Telephone',
		'Email' => 'Email',
		'Created' => 'CreatedText'
	);
	
	public static $casting = array("CreatedText" => "Text"); 
	
   public function CreatedText() {
      return $this->Created;
   }

class crmAdmin extends ModelAdmin {

	public static $menu_title = 'Customer Relationship Manager';
	public static $url_segment = 'crm';
	public static $managed_models = 'CustomerGroup';

[...]

Avatar
Willr

Forum Moderator, 5523 Posts

8 August 2012 at 9:06pm

Your managing the 'CustomerGroup' class but your object classname is Customer?