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.

Template Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

GroupedBy not working


Go to End


2 Posts   1652 Views

Avatar
dacar

Community Member, 173 Posts

9 July 2013 at 7:06am

Hi, in my template i use a loop to get all the children of a holder page

<% loop AllChildren.GroupedBy(Zimmerart) %>
<li>$ClassName $Zimmerart</li><% end_loop %>
The Loop returns the correct name of the Class and the correct content for the variables $Zimmername.

But if i try to group the loop, nothing will be returned:

<% loop AllChildren.GroupedBy(Zimmerart) %><li>$ClassName $Zimmerart</li><% end_loop %>

Can anybody give a hint? Greetings, Carsten.

Avatar
(deleted)

Community Member, 473 Posts

9 July 2013 at 8:23am

See the documentation on how to group DataLists. GroupedBy is no longer a method you can just call from the templates.