I would do this with a snippet tag that looked like: <lift:MyTable.foo> <table> <tb:entries> <tr><td><entry:name /></td></tr> </tb:entries> </table> </lift:MyTable.foo>
Then the snippet would look like class MyTable { def foo (xhtml : NodeSeq) : NodeSeq = { val data = ... fill this in ... val entries = data.flatMap(bind("entry", chooseTemplate("tb", "entries", xhtml), "name" -> Text(_.name))) bind("tb", xhtml, "entries" -> entries) } } That's from memory so I may be a little off. I'm also assuming that data is some sort of Scala collection. Anyways, the combination of bind and chooseTemplate lets you keep all the presentation XML and Scala logic cleanly separated. Derek On Sun, Apr 12, 2009 at 10:03 PM, sailormoo...@gmail.com < sailormoo...@gmail.com> wrote: > > Hello: > > Thanks for the previous answers of my questions. > I would like to know how to make the following example work by Lift: > ( I use the old style Java scriptlet for example ). > > <table> > <% for (int i = 0; i < data.size(); i++) { %> > <tr><td><%= data.name %></td></tr> > <% } %> > </table> > > I cannot find an example like this, and I don't know if it should be > done by a single snippet with all the rows, or some list/array to > iterate in the view. > > Thanks. > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---