[Lift] Re: XML Creation

2009-04-13 Thread sailormoo...@gmail.com
I wrote a zip function to group the list as follows: scala> def zipListBySize[T](size: Int)(list: List[T]) : List[List[T]] = { | var (first, second) = list.splitAt(size) | if (second == Nil) | List(first) | else | List(first) ++ zipListBySize(size)(second)

[Lift] Re: XML Creation

2009-04-13 Thread David Pollak
>From the ToDo sample code... the view code: Exclude done 1 To Do So, you want the body of for each element. Here's the Snippet code: def list(html: NodeSeq) = {

[Lift] Re: XML Creation

2009-04-13 Thread Timothy Perrett
If you want 5 items a line, you can use nested binds - checkout the chooseTemplate(...) method. Any pagination or limiting you need to do, just do that in your snippet however you want to page your result set :-) On Apr 13, 7:18 am, "sailormoo...@gmail.com" wrote: > I See...Thanks... > and if I

[Lift] Re: XML Creation

2009-04-13 Thread Charles F. Munat
No. That will get you the same name five times per line, with one line per name. For example, Bob Bob Bob Bob Bob Sam Sam Sam Sam Sam etc. I can't think of anything but complicated ways to do this right now because I'm exhausted, but if someone else doesn't give you one by tomorrow, I'll try

[Lift] Re: XML Creation

2009-04-13 Thread sailormoo...@gmail.com
I See...Thanks... and if I want 5 items a line does it work as follows? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to li

[Lift] Re: XML Creation

2009-04-13 Thread Atsuhiko Yamanaka
Hi, On Mon, Apr 13, 2009 at 1:03 PM, sailormoo...@gmail.com wrote: > >  <% for (int i = 0; i < data.size(); i++) { %> >    <%= data.name %> >  <% } %> > > >  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 t

[Lift] Re: XML Creation

2009-04-12 Thread Charles F. Munat
I do it like this: Let's say it's a list of companies in which the name of the company links to the company's website. So you have a snippet that handles these Companies. Let's call it CompanyOps.scala. In the snippet, you have a method which we'll call list. In the method, you get the list o

[Lift] Re: XML Creation

2009-04-12 Thread Derek Chen-Becker
I would do this with a snippet tag that looked like: 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" -> T