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.

Template Questions /

How to use DataObjectSet->GroupedBy() ?


Reply


4 Posts   2220 Views

Avatar
brokemeister

Community Member, 30 Posts

30 July 2009 at 2:05am

Edited: 30/07/2009 2:07am

Hi!
How does the GroupedBy work?
Items returns a DataObjectSet...

I just have these lines, which do not work... :(

<% control Items.GroupedBy(Title) %>
   <% control Children %>
      <div class="item $ClassName">
         
            <h3>$Title</h3>
         
         <h4>$Role<br />$FirstName $LastName</h4>
         <p>$Phone<br />$Fax<br />Email</p>
      </div>
   <% end_control %>
<% end_control %>

Any ideas?

Thanks
Malte

Avatar
Willr

Forum Moderator, 5513 Posts

30 July 2009 at 9:18am

Hmm can't say I have ever tried to use GroupedBy in a template file. If that doesn't work you might want to try:

function GroupedSomething() {
$children = $this->Children();
if($children) $children->groupBy('Title');
return $children;
}

Avatar
kimmings

Community Member, 2 Posts

17 November 2009 at 3:37am

I have a similar issue.
When I use $dataSet->groupBy('column-name') I get a blank page.
When I remove the groupBy method the page displays :(

Avatar
brokemeister

Community Member, 30 Posts

17 November 2009 at 3:45am

A while a go I got it working, but if I remember it corretly. It was only working with pages.