On Sun, Nov 8, 2009 at 7:45 PM, Neil.Lv <anim...@gmail.com> wrote:

>
>
>  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=> {
>
data.toList.flatMap(...)


> 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 <naftoli...@gmail.com> 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<anim...@gmail.com> 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
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to