Ok, from the top. The actor sends the following partialUpdate:
partialUpdate(creations)
Where creations is
def creations = {
JsCrVar("newDiv", Jq(JsRaw(newDiv(obj).toString.encJs)) ~>
JsFunc("hide")) &
Jq(JsVar("newDiv")) ~> JsFunc("insertInOrder", "#" + BLAH) &
JsRaw("newDiv") ~> JsFunc("fadeIn", "slow")
}
Where newDiv is
private def newDiv(obj) = {
val activity = new com.mysnippet.snippet.Activity
activity.bind(templateHtml, obj);
}
templateHtml is a val in a companion class. It is identical to a
normal template. Note we reuse a snippet. In the snippet:
def bindCompliancy(html:NodeSeq, obj:Any) : NodeSeq = {
bind("policyActivity", html,
....
"response" -> responseLink(obj, Empty),
....
)
}
And:
def responseLink(obj:Any) : NodeSeq = {
a(() => ignoreClicked(obj),
<span>ignore for now</span><span id=
{HtmlHelper.makeDomIdSafe(obj.toString.trim) + "ignore"}/>,
("title", "A tooltip"));
}
Does that help?
My basic aim is to return a textual clickable node within a
partialUpdate which will perform an AJAX call when clicked.
Dan
On Jan 8, 2:14 pm, Marius <[email protected]> wrote:
> I need to see a sample code how you are creating the link and how you
> set it on the JsCmd. No <lift:a> is not automatically resolved as the
> a snippet is not processed here.
>
> Typically if you want to deal with xml nodes and JsCmc you'd need to
> use Jx classes. This creates a JS document fragment out of your Node.
>
> Br's,
> Marius
>
> On Jan 8, 4:07 pm, Dan Gravell <[email protected]> wrote:
>
> > Hi Marius. It's pretty simple:
>
> > creations : Seq[JsCmd]
> > deletions : Seq[JsCmd]
> > partialUpdate(JsCmds.seqJsToJs(creations ++ deletions))
>
> > Which is just a seq of JsCmds right? The JsCmds themselves appear to
> > work ok, it's just that a small part of their content (this AJAX <a>)
> > is not rendered correctly.
>
> > The JsCmds themselves declare a JsVar with the NodeSeq as a value by
> > calling toString on the NodeSeq. This JsVar is then inserted into the
> > HTML using JQuery.
>
> > I guess there is something that goes on after a NodeSeq is returned in
> > a normal snippet that I am not doing here to resolve the <lift:a> tag?
>
> > Let me know if I am not being clear.
>
> > Thanks,
> > Dan
>
> > On Jan 8, 1:55 pm, Marius <[email protected]> wrote:
>
> > > How does you partialUpdate code looks like?
>
> > > Note that with partialUpdate you need to return a JsCmd, and not a
> > > NodeSeq.
>
> > > Br's,
> > > Marius
>
> > > On Jan 8, 2:25 pm, Dan Gravell <[email protected]> wrote:
>
> > > > I'm really enjoying using Lift. It makes this AJAX and comet stuff
> > > > very easy!
>
> > > > I have a problem with rendered AJAX NodeSeqs using SHtml.
>
> > > > This is within a Comet actor. On first render, it works fine. For
> > > > instance, in my HTML, I get:
>
> > > > <a key="F2524140538393W2" href="javascript://"
> > > > onclick="lift_ajaxHandler('F2524140538393W2=true', null, null)">
> > > > <span>stuff</span>
> > > > <span id="someuniqueid"/>
> > > > </a>
>
> > > > The <a> and two <span>s are the rendered content.
>
> > > > On partial updates however, I get this:
>
> > > > <lift:a key="F555356094486VTJ">
> > > > <span>stuff</span>
> > > > <span id="someuniqueid"/>
> > > > </lift:a>
>
> > > > It looks like the <a> is not fully rendered.
>
> > > > The call to SHtml.a() occurs within the context of a bind() call - I
> > > > assume this is ok.
>
> > > > If anyone could help I'd be most grateful.
>
>
--
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.