The problem with writing two spans in Scala is that one is a whole expression. 
So either concatenate them with ++, or surround them with <xml:group>..., which 
is a fake xml element to wrap a few elements as one expression.

-------------------------------------
Franz Bettag<[email protected]> wrote:

What i am trying to do, maybe i am doing it all wrong.

The html/xml can be found here: http://pastie.org/787126

The question is, what is the best way to render the bound XML which i
pass in ip:expand, so that upon the "actions" click, it will be
rendered in the correct table on the page. I haven't figured out how a
snippet might just return a string which gets passed as id/class of an
html-tag.

i hope you see my problem, because i am diddling around with this for
like 4 hours straight and i don't find a way to simply tell it "the
lift way" to do the ajax request and replace div XY.
The replacing is not the problem. but how do i get an ID or something
into the template where it gets rendered.

It is also a mystery to me, why a snippet can't return something like
<span/><span/>. I haven't found any clue on how to simply return a
group of xml objects. i always need to pack around some span or god
knows what to make that happen. This is especially bad if you want all
the nifty "split design and code" but are not able to somehow let the
user design his table because if you nest it (like i try to), you may
end up with a tbody in a tbody..

these simple things are really badly documented for beginners. Mostly
because i wouldn't know what that method/class i need would be
called. :)

best regards

On 20 Jan., 21:44, Ross Mellgren <[email protected]> wrote:
> Scala can't figure out what type of parameter you mean, so you need to 
> annotate it  -- "expand" -> (fooXhtml: NodeSeq) => {... }
>
> Or use a separately named function with a type signature, e.g.
>
> def doTheStuff(ns: NodeSeq): NodeSeq) = { Log.error(ns.toStrnig); <span /> }
>
> bind(..., "expand" -> doTheStuff _)
>
> -Ross
>
> On Jan 20, 2010, at 3:41 PM, Franz Bettag wrote:
>
> > "expand" -> (fooXhtml) => { Log.error(fooXhtml.toString); <span/> },
>
> > error: not a legal formal parameter (pointing at the => )
>
> > On 20 Jan., 21:32, greekscala <[email protected]> wrote:
> >> Hello,
>
> >> yes a function that takes NodeSeq parameter and returns
> >> a NodeSeq :)
>
> >> "foo" -> (ns) => {function body} or
> >> "foo" -> theCalledFunction
>
> >> best regards
>
> >> On 20 Jan., 21:26, Franz Bettag <[email protected]> wrote:
>
> >>> How would that look like?
> >>> "foo" => nodeSeqMethod _ ?
>
> >>> On 20 Jan., 21:21, Naftoli Gugenheim <[email protected]> wrote:
>
> >>>> Meaning to the right of the -> arrow.
>
> >>>> -------------------------------------
>
> >>>> Franz Bettag<[email protected]> wrote:
>
> >>>> Ah figured it out. Played long enough around to get the right way:
>
> >>>> () => {expand(trafficReply.subnet)}
>
> >>>> Another question though, would it be possible to use
> >>>> <IPs:expand><span><traffic:sometag/></span></IPs:expand> and pass the
> >>>> given NodeSeq over the bind into a function?
>
> >>>> On 20 Jan., 19:08, Franz Bettag <[email protected]> wrote:
>
> >>>>> Sorry if i am asking a lot of questions lately, but i am trying to get
> >>>>> this project of mine working so i can write about the specific
> >>>>> problems i ran into and how they got done.
>
> >>>>>         def subnets(xhtml: NodeSeq): NodeSeq = {
> >>>>>                 val content = IPnet.findAll(OrderBy(IPnet.name, 
> >>>>> Ascending)).map(ip
> >>>>> => {
>
> >>>>>                         /* Bind the xml */
> >>>>>                         bind("ip", xhtml,
> >>>>>                                 "subnet" -> Text(ip.name.toString),
> >>>>>                                 "action" -> SHtml.a(expand(ip.subnet) 
> >>>>> _, "See all IPs")
> >>>>>                                 )
> >>>>>                 }).mkString
>
> >>>>>                 XML.loadString("<span>%s</span>".format(content))
> >>>>>         }
>
> >>>>>         def expand(subnet: String): JsCmd = {
> >>>>>                 Log.info("Requested subnet %s".format(subnet))
> >>>>>                 Alert("subnet %s was requested".format(subnet))
> >>>>>         }
>
> >>>>> The Problem is the "action" that gets binded. I don't get how i have
> >>>>> to use SHtml.a to pass a value to the called function. Any hints?
>
> >>>>> Thank you very much in advance
>
> >>>> --
> >>>> 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 
> >>>> athttp://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 [email protected].
> > To unsubscribe from this group, send email to 
> > [email protected].
> > For more options, visit this group 
> > athttp://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 [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.


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