Jump to:

23371 Posts in 18161 Topics by 2865 members

General Questions

SilverStripe Forums » General Questions » SS_Datetime in GridField - Header text not applied and click-to-sort changes to search

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: 127 Views
  • Double-A-Ron
    Avatar
    Community Member
    604 Posts

    SS_Datetime in GridField - Header text not applied and click-to-sort changes to search Link to this post

    Not sure if either of these two things is a bug, or can be explained with configuration. But both only seem to apply to DateFields displayed in a GridView. The second might apply to the presence of empty rows of data (for that column)

    Problem 1 - Using $summary_fields to set custom header text works, but not for DateFields.

    In my DataObject for the grid, I have this:

    private static $db = array(
          'SessionStart' => 'SS_Datetime',
          'SessionEnd' => 'SS_Datetime'      
       );
       
       private static $has_one = array(
          'CMSAdminUser' => 'Member',
          'AnotherObject' => 'MyObject'   
       );   

    private static $summary_fields = array(
          'CMSAdminUser.FirstName' => 'This header text appears on the GridFeild',
          'AnotherObject.Title' => 'So does this header text',
          'SessionStart' => 'The header for this is "Session Start" no matter what',
          'SessionEnd' => 'And this one is always "Session End"'
       );

    The titles I have in $summary_fields array values should explain the issue. Any ideas? Tried dev/build, ?flush=all etc. In fact I've tested that I can change the other two fields and the two SS_Datetime fields are ignored. Data in the GridField cells is fine though.

    Problem 2 - GridField loads with SS_Datetime headers as 'Sortable', but after the first 'click to sort', header changes to a search

    It's worth noting that this only happens with the SessionEnd data, and some of the rows for this column are empty. The SessionStart column is always populated and doesn't exhibit the same. Might be best explained with screen shots:

    On load:

    After first click sort on "Session End" header:

    Note that also the "Session End" header text completely disappears after the click. Never to return.

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