For iterating over an array, see http://www.jsviews.com/#fortag. (Lower in the page shows the use of the tag for looping over an array).
Also, some comments about your template example:
It looks like you are using a generated template, with the value of the columnName
parameter inserted. So if columnName
has the value "fooColumn"
your template snippet is {{:#data['fooColumn']}}
- which is actually equivalent to {{:#data.fooColumn}}
, which can be further simplified to {{:fooColumn}}
.
(I assume the value of columnName
is a valid JavasScript name - not some value like "foo column"
, say, with white space - in which case your syntax would indeed be appropriate.)
Now, if #data.fooColumn
is an array of objects each of which has a 'itemProperty'
property, then using {{for}}
to iterate over the array looks like this (slight change on David Ward's example):
<ul>
{{for fooColumn}}
<li>{{:itemProperty}}</li>
{{/for}}
</ul>
The generated form of that using columnName would be
"<ul>{{for " + columnName + "}}<li>{{:itemProperty}}</li>{{/for}}</ul>"