[Seaside] Iterations

Avi Bryant avi@beta4.com
Mon, 17 Jun 2002 01:52:29 -0700 (PDT)

On Mon, 17 Jun 2002, Markus Fritsche wrote:

>     <table><tr sea:id="each/categories"><wbcategory
> sea:id="each"></wbcategory></tr><table>
> "categories is a collection of WBCategory s"

Ok, I think this is where you're going wrong.  WBCategory is a subclass of
IAComponent, right?  You don't want to iterate over a list of components;
instead, you want to iterate over data.  If 'categories' were a list of
category names, you could do something like

<table><tr sea:id="each/categories">
<page sea:id="category"></page>

addBindingsTo: template
  (template elementNamed: 'category')
     class: WBCategory;
     set: #name toPath: 'each'

Does that make any sense?  Rather than having multiple WBCategory
components, you just have one - but you display it repeatedly, binding
its 'name' to a different value each time.

Generally, if you're manually creating and managing subcomponent objects,
you're doing something wrong (or at least, something unusual).

If I'm misunderstanding your questions, let me know.