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
Hi,
On Mon, Apr 13, 2009 at 1:03 PM, sailormoo...@gmail.com
sailormoo...@gmail.com wrote:
table
% for (int i = 0; i data.size(); i++) { %
trtd%= 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
I See...Thanks...
and if I want 5 items a line
does it work as follows?
lift:MyTable.foo
table
tb:entries
tr
tdentry:name //td
tdentry:name //td
tdentry:name //td
tdentry:name //td
tdentry:name //td
/tr
/tb:entries
/table
/lift:MyTable.foo
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
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 sailormoo...@gmail.com
wrote:
I
From the ToDo sample code... the view code:
lift:TD.list all_id=all_todos
div id=all_todos
divExclude done todo:exclude//div
ul
todo:list
li
todo:checkinput type=checkbox//todo:check
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)
I would do this with a snippet tag that looked like:
lift:MyTable.foo
table
tb:entries
trtdentry: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