Jump to:

22972 Posts in 11596 Topics by 2824 members

General Questions

SilverStripe Forums » General Questions » ss3 $summary_fields with date fields

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

Page: 1
Go to End
Author Topic: 405 Views
  • Futureweb
    Avatar
    Community Member
    232 Posts

    ss3 $summary_fields with date fields Link to this post

    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

  • Sticks
    Avatar
    Community Member
    29 Posts

    Re: ss3 $summary_fields with date fields Link to this post

    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.

  • Futureweb
    Avatar
    Community Member
    232 Posts

    Re: ss3 $summary_fields with date fields Link to this post

    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'
    );

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