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.

General Questions /

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

ss3 $summary_fields with date fields


Reply


3 Posts   554 Views

Avatar
Futureweb

Community Member, 233 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
Futureweb

Community Member, 233 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'
);