For simplicity, imagine that I have a list of lists. I want to display a html table where there is a row for each element of the top-level list and each column in the row is an element of the child list.
So
List(List(1,2,3), List(4,5,6), List(7,8,9))
would result in an html table that is displayed like this:
1 2 3
4 5 6
7 8 9
10 11 12
Here's my attempt (the template)
<table>
<lift:viewQuery.res2>
<tr>
<a:row>
<td><a:num/></td>
</a:row>
</tr>
</lift:viewQuery.res2>
</table>
And the relevant method in the snippet:
def res2(in :NodeSeq) : NodeSeq = {
val data = List(List(1,2,3), List(4,5,6), List(7,8,9), List(10,11,12))
def bindChild(child : List[Int],in :NodeSeq) = {
child.flatMap(c => Helpers.bind("a", in,
"num" -> c.toString))
}
data.flatMap(childList => Helpers.bind("a", in,
"row" -> bindChild(childList, in)))
}
When i go to the page it gives me the following errors:
error on line 28 at column 23: Namespace prefix a on row is not defined
error on line 29 at column 31: Namespace prefix a on num is not defined
error on line 34 at column 23: Namespace prefix a on row is not defined
error on line 35 at column 31: Namespace prefix a on num is not defined
...
Any ideas on the best way to handle this?