3063 Posts in 864 Topics by 646 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1061 Views |
-
Returning data grouped by value [SOLVED]

2 November 2009 at 1:23am Last edited: 2 November 2009 10:15pm
I've got a bunch of dataobjects (lets call them Events) that each have a related category (EventCategory) and I'd like to return these to the template view so that I could show the events listed by category, something like:
Category 1 title
Event name
Event nameCategory 2 title
Event nameCategory 3 title
Event name
Event nameHow would I go about doing this, so that I can have a dynamic amount of categories (a category will always have events too)?
-
Re: Returning data grouped by value [SOLVED]

2 November 2009 at 7:16am
I recently had the same question and the way that I got around it was to use the NestedDataObjectManager, this allowed each page to has_many categories then each category to has_many objects. This way you could add many categories to each page as needed then add the objects to those categories. In the template it was then as simple as:
<% control Categories %>
$CategoryTitle
<% control Events %>
$EventTitle - $Description
<% end_control %>
<% end_control %> -
Re: Returning data grouped by value [SOLVED]

2 November 2009 at 10:15pm
Thanks Howard, I worked it out just as you posted that one!
Cheers
| 1061 Views | ||
|
Page:
1
|
Go to Top |

