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

Reply via email to