I should have also mentioned that there is now "while" component support
w/ the same limitations:
<while condition="...">
</while>
The condition works the same as the <!if> (it actually extends from
if). However, with this component you should be very careful to ensure
the condition evaluates to false at some point! It doesn't do anything
to prevent infinite loops -- foreach is safer in this respect.
Oh... one other limitation (bug) is that ${} expressions aren't working
as they're supposed to... use #{} instead. I wanted to get this out
soon... but the quality is not like the rest of JSFTemplating yet. :(
Thanks for the kind comments Anissa!
Ken
Anissa Lam wrote:
> Hi Ken,
> This is a really great feature provided by jsftemplating. Even with
> all the limitation that you specified, the current support makes
> putting varied # of same components inside a table cell so easy.
> Thanks for the sample that shows clearly how to use this feature.
>
> Anissa.
>
> Ken Paulsen wrote:
>>
>> I have finished an initial implementation of a foreach component.
>> There are some things it doesn't do the way I feel it should, mostly
>> around events. The equivalent foreach LayoutElement used during
>> component creation provides events for "beforeLoop" / "afterLoop" and
>> treats "encode" / "beforeEncode" / "afterEncode" differently. Please
>> do not rely on these events for the "component version" of
>> "foreach". I have to finish implementing this behavior and your code
>> will break if you use these features.
>>
>> Events inside components, inside a foreach are fine, though.
>>
>> Another feature that does *not* exist is "decode behavior" for
>> components inside a foreach. In other words, you cannot handle
>> actions (or command events) for any component that is inside a
>> foreach. If you do, the results are not supported at this time. You
>> may get around this by using hyperlinks that pass information to the
>> server via QUERY_STRING parameters.
>>
>> Attached is an example page that uses the loop inside a table.
>>
>> Thanks!
>>
>> Ken