How to sort ViewHelper array?

2.2k Views Asked by At

I have the following template:

<f:for each="{matchday.matches}" as="match" iteration="matchIterator">
<f:if condition="{match.home_team._id} == {team}">
    <f:render section="match" arguments="{match: match, is_home: 1, round_number: matchday.round_number}" />
</f:if>
<f:if condition="{match.away_team._id} == {team}">
    <f:render section="match" arguments="{match: match, is_home: 0, round_number: matchday.round_number}" />
</f:if>

All entries are sorted by Id. matches has an attribute play_date which contains the correct date of the match.

How I can sort the array by date before output?

I already tried using SortViewHelper but it didn't work:

<f:for each="{matchday.matches->v:iterator.sort(order: 'ASC', sortBy:'play_date')}" as="match" iteration="matchIterator">
0

There are 0 best solutions below