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.

General Questions /

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

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

ss3 $summary_fields with date fields


Go to End


3 Posts   1495 Views

Avatar
JonShutt

Community Member, 244 Posts

19 March 2013 at 12:17pm

I've noticed that summary fields doesn't seem to work when setting the title of a date field.

 public static $summary_fields = array( 
       'Member.FirstName' => 'First Name',
	   'Member.Surname' => 'Surname',
           'Member.Email' => 'Email',	
	   'StartDate' => 'First Night',
	   'EndDate' => 'Last Night', 	   
	   'Status'=>'Booking Status'  
   );

In the example above, the titles all show correctly for first name, last name, email, booking status, but the date fields just show 'Start Date' and ignore the title i've given them?

Is it a bug, or am I missing something? This is a datagrid field in a model admin area...

cheers

Avatar
Sticks

Community Member, 31 Posts

6 June 2013 at 3:24pm

I'm having this same issue. I can set a custom label when calling a function in Summary fields (and in the above case it looks like it works with dot notation), but when using the local values the GridField shows the field name regardless of whether a custom label is given or not.

Avatar
JonShutt

Community Member, 244 Posts

6 June 2013 at 5:34pm

Stick Sticks - ended up doing the following:



// Tell the datagrid what fields to show in the table
   public static $summary_fields = array( 
	'Member.FirstName',
	'Member.Surname',
        'Member.Email',	
	'StartDate',	   
	'Status'
   );
   
   static $field_labels = array ( 
	'Member.FirstName' => 'First Name',
	'Member.Surname' => 'Surname',
	'Member.Email' => 'Email',	
	'StartDate' => 'First Night',		
	'Status'=>'Status'  
   );