How should i write the bind code ?
var data = Map(2009/10/09 -> List(St1), 2009/10/10 -> List(Hello, M7,
123,da))
....
data.flatMap(d=> {
Log.info(" *************************:" + d)
bind("data", in,
"date_title" -> Text("222")
)
})
Get this erors:
found : Iterable[scala.xml.Node]
required: scala.xml.NodeSeq
data.flatMap(d=> {
I'm not familiar with this.
I want the page show like this:
date - 2009/10/09
st1
date - 2009/10/10
Hello
M7
123
da
Cheers,
Neil
On Nov 9, 11:35 am, Naftoli Gugenheim <[email protected]> wrote:
> That should not be foreach but flatMap.
> Foreach is like map but returns Unit, and flatMap is like map but it
> concatenates the resulting elements, which must be iterable (or iterators,
> depending).
>
> -------------------------------------
>
> Neil.Lv<[email protected]> wrote:
>
> Hi all,
>
> How to bind the Map to View in the Snippet ?
>
> This is the bind code
> ###
> scala.collection.mutable.Map[String,List[String]] =
> Map(2009/10/09 -> List(St1), 2009/10/10 -> List(Hello, M7, 123,
> da))
>
> var data = Map(2009/10/09 -> List(St1), 2009/10/10 -> List(Hello,
> M7, 123, da))
> def doList(in : NodeSeq) : NodeSeq = {
> data.foreach(d=> {
> bind("data", in,
> "time" -> Text({d._1}),
> "list" -> bindList(d._2)
> )
> })
>
> def bindList(lists:List[String]) = {
> lists flatMap { l =>
> bind("sec", chooseTemplate("data", "list", in),
> "title" -> Text(l))
> }
> ###
>
> It always show this message:
> found : Unit
> required: scala.xml.NodeSeq
> data.foreach(d=> {
>
> Cheers,
> Neil
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---