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

Loosing sorting abillity when using the .Nice syntax


Go to End


658 Views

Avatar
mi32dogs

Community Member, 75 Posts

14 February 2017 at 11:57am

Edited: 14/02/2017 11:57am

When I set the $summary_fields in a dataobject and use the .Nice syntax I will lose the ability to sort on this column, for example:

public static $summary_fields = array(
        'Date1' => 'Date 1',
        'Date2.Nice' => 'Date 2',
        'Date3.NiceUS' => 'Date 2',
        'boolean1' => 'Boolean 1',
        'boolean1.nice' => 'Boolean 2'
    );

In the example above I can sort the gidfield by “date 1”, but I cannot sort by “Date 2” or “Date 3”, the same for Booleans I can sort by “Boolean 1” but not by “Boolean 2”

Is this normal? And if so is there a workaround to get the sorting to work with better looking dates?