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:

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

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

Go to End



Community Member, 607 Posts

12 March 2014 at 9:02am

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.