Hmm that _was_ pretty silly. I guess I have to go over the implicits section
in my Scala notes :)

Thanks for the quick response David.

On Wed, Dec 30, 2009 at 2:19 PM, David Pollak <feeder.of.the.be...@gmail.com
> wrote:

>
>
> On Wed, Dec 30, 2009 at 11:03 AM, Igor <igor...@gmail.com> wrote:
>
>> Hi everyone,
>>
>> Long time lurker, first time poster here, I've been trying to pick up
>> Lift recently and am stuck with a seemingly simple bind:
>> <div>
>> <subject:videos>
>>    <videos:count/> out of <videos:total/> videos
>>    <videos:list>
>>        <div>
>>            <video:name/> <span class="cm"> some text</span>
>>        </div>
>>    </videos:list>
>> </subject:videos>
>> </div>
>>
>> val length = resources.length
>> bind("videos", template,
>>     "count" -> length,
>>     "total" -> length,
>>     "list" -> {(ns: NodeSeq) => resources.flatMap(c => bind("video",
>> ns,
>>                                                             "name" ->
>> <a href="#">{c.displayName}</a>))})
>>
>>
>>
> {(ns: NodeSeq) => (resources.flatMap(c => bind()): NodeSeq)}
>
> That should do it.  You have to tell the compiler you want a NodeSeq out of
> the function and the compiler will apply the implicit conversion from
> List[Node] -> NodeSeq
>
>
>> This is throwing the following compiler error:
>>
>> error: overloaded method value bind with alternatives
>> (String,net.liftweb.common.Box[(scala.xml.NodeSeq) =>
>> scala.xml.NodeSeq],net.liftweb.common.Box
>> [(scala.xml.PrefixedAttribute) =>
>> scala.xml.MetaData],scala.xml.NodeSeq,net.liftweb.util.Helpers.BindParam*)
>> scala.xml.NodeSeq <and>
>> (String,scala.xml.NodeSeq,net.liftweb.util.Helpers.BindParam*)
>> scala.xml.NodeSeq cannot be applied to
>>
>> (java.lang.String,scala.xml.NodeSeq,net.liftweb.util.Helpers.IntBindParam,net.liftweb.util.Helpers.IntBindParam,
>> (String, (scala.xml.NodeSeq) => List[scala.xml.Node]))
>>        bind("videos", template,
>>
>>
>> Now as far as I can tell the issue is that I'm getting a List
>> [scala.xml.Node] out of the flatMap. For some reason I thought I was
>> able to do this before but if not should I be doing something else to
>> convert it to a NodeSeq instead ?
>>
>> I basically have a section that I want to populate with some content
>> (1 content item per list item) and also stick the length of the list
>> in the top of the section.
>>
>> Not sure if my whole approach is flawed or not, open to any
>> suggestions or pointers to the relevant section of TFM.
>>
>>
>> Thanks a lot,
>> Igor
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups
>> "Lift" group.
>> To post to this group, send email to lift...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/liftweb?hl=en.
>>
>>
>>
>
>
> --
> 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 lift...@googlegroups.com.
> To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en.
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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