[Lift] Re: guid - function mapping not occuring for ajax generator rendered by CometActor
Marius, All working great now. Thanks for the quick response and fix. Chris On Dec 29 2009, 1:35 am, Marius marius.dan...@gmail.com wrote: This was a non trivial hustle to find the cause:) ... See each Lift function is bound to an owner. The owner can be the pageId (generated by Lift) or the Comet ID. In this case since the function is bound from Comet the owner is the Comet ID. Therefore when clicking on this doesn't (via comet actor) the function execution is forwarded to the CometActor (synchronously) in order to send down to the client potential other messages that the CometActor has at that point in time. The problem was that the S context was incorrectly initialized when this occurred. I opened defecthttp://github.com/dpp/liftweb/issues/#issue/264... and I'm posting the fix on the review board in a few minutes. Br's, Marius On Dec 27, 4:42 pm, Marius marius.dan...@gmail.com wrote: AH sorry ... I didn't put your exac same snippets because I have a demo app already there and I only had to do mino change to try your scenario. Here is what I have now: The snippet: class Hello { def ajaxCometLink(xhtml: NodeSeq): NodeSeq = { bind(st, xhtml, something - SHtml.a(() = { println(The damn one clicked) SetHtml(time, bClicked/b) }, Text(Another damn one))) } } and the Comet render: def render = { val res: NodeSeq = bind(time - timeSpan) ++ lift:Hello.ajaxCometLinkst:something// lift:Hello.ajaxCometLink res } It still works for me. Could you please send a minimalistic Lift application as a zip file (including your Boot, pom.xml, etc) where you reproduce this? Something that I could just run it and see the effect? I could look on it tomorrow. Br's, Marius On Dec 27, 4:18 pm,ChrisXxtopher@gmail.com wrote: Hi Marius, Thanks for your response. The issue occurs when using inline template xhtml as the content for SetHtml, which itself is the callback function for an ajax generator (I do this for reuse of ajax rendered elements that are accessible from different parts of the same page, and are sometimes several generated ajax callback levels deep, e.g. cometactor renders ajax element that renders another ajax element, etc.), as I have illustrated in the example - namely with: def render = a(()= { SetHtml(whatever, lift:TS.stuff2st:something//lift:TS.stuff2) }, Text(this doesn't (via comet actor))) The rest of the code in my example supports this as a complete runnable example, and also illustrates that rendering the same code from a snippet (vs a CometActor), works. Regards, Chris On Dec 27, 8:26 pm, Marius marius.dan...@gmail.com wrote: Hmm that's weird. I have the master sources and a CometActor with a render like: def render = { val link: NodeSeq = SHtml.a(()= { println(Link clicked) SetHtml(time, bClicked/b) }, Text(this doesn't (via comet actor))) val res: NodeSeq = bind(time - timeSpan) ++ link res } and the Ajax link works just fine for me. Br's, Marius On Dec 27, 7:36 am,ChrisXxtopher@gmail.com wrote: Hi guys, I've recently migrated some code which leverages ajax and comet quite heavily, from 1.1-M4 to 1.1-M8 and have found that the function binding for a rendered ajax element, bound to a template which is itself the target of another ajax element, rendered via a CometActor (a mouthful I know) - no longer works. Rendering the same ajax element via a template works, and previously worked via a CometActor in 1.1- M4. The javascript callback code (and it's associated GUID) is generated, and the ajax_request successfully hits jetty, but I'm assuming something related to the guid-function mapping is not occurring, as the function isn't invoked. I've distilled the problem to an example below: Template: lift:surround with=default at=content lift:TS.stuff / lift:comet type=MyActor / div id=whatever / /lift:surround Snippet: class TS { def stuff(in: NodeSeq): NodeSeq = a(()= { SetHtml(whatever, lift:TS.stuff2st:something//lift:TS.stuff2) }, Text(this works (via snippet))) def stuff2(in: NodeSeq): NodeSeq = bind(st, in, something - a (() = {println(clicked); Noop}, Text(click me))) } CometActor: class MyActor extends CometActor { //def render = SetHtml(whatever, lift:TS.stuff2st:something// lift:TS.stuff2) // works def render = a(()= { SetHtml(whatever, lift:TS.stuff2st:something//lift:TS.stuff2) }, Text(this doesn't (via comet actor))) } Can you give an indication of whether this change since M4 is intentional or if it will be working in future? Cheers, Chris -- You received this
[Lift] Re: guid - function mapping not occuring for ajax generator rendered by CometActor
Hi Marius, Thanks for your response. The issue occurs when using inline template xhtml as the content for SetHtml, which itself is the callback function for an ajax generator (I do this for reuse of ajax rendered elements that are accessible from different parts of the same page, and are sometimes several generated ajax callback levels deep, e.g. cometactor renders ajax element that renders another ajax element, etc.), as I have illustrated in the example - namely with: def render = a(()= { SetHtml(whatever, lift:TS.stuff2st:something//lift:TS.stuff2) }, Text(this doesn't (via comet actor))) The rest of the code in my example supports this as a complete runnable example, and also illustrates that rendering the same code from a snippet (vs a CometActor), works. Regards, Chris On Dec 27, 8:26 pm, Marius marius.dan...@gmail.com wrote: Hmm that's weird. I have the master sources and a CometActor with a render like: def render = { val link: NodeSeq = SHtml.a(()= { println(Link clicked) SetHtml(time, bClicked/b) }, Text(this doesn't (via comet actor))) val res: NodeSeq = bind(time - timeSpan) ++ link res } and the Ajax link works just fine for me. Br's, Marius On Dec 27, 7:36 am, ChrisX xtopher@gmail.com wrote: Hi guys, I've recently migrated some code which leverages ajax and comet quite heavily, from 1.1-M4 to 1.1-M8 and have found that the function binding for a rendered ajax element, bound to a template which is itself the target of another ajax element, rendered via a CometActor (a mouthful I know) - no longer works. Rendering the same ajax element via a template works, and previously worked via a CometActor in 1.1- M4. The javascript callback code (and it's associated GUID) is generated, and the ajax_request successfully hits jetty, but I'm assuming something related to the guid-function mapping is not occurring, as the function isn't invoked. I've distilled the problem to an example below: Template: lift:surround with=default at=content lift:TS.stuff / lift:comet type=MyActor / div id=whatever / /lift:surround Snippet: class TS { def stuff(in: NodeSeq): NodeSeq = a(()= { SetHtml(whatever, lift:TS.stuff2st:something//lift:TS.stuff2) }, Text(this works (via snippet))) def stuff2(in: NodeSeq): NodeSeq = bind(st, in, something - a (() = {println(clicked); Noop}, Text(click me))) } CometActor: class MyActor extends CometActor { //def render = SetHtml(whatever, lift:TS.stuff2st:something// lift:TS.stuff2) // works def render = a(()= { SetHtml(whatever, lift:TS.stuff2st:something//lift:TS.stuff2) }, Text(this doesn't (via comet actor))) } Can you give an indication of whether this change since M4 is intentional or if it will be working in future? Cheers, Chris -- 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.
[Lift] guid - function mapping not occuring for ajax generator rendered by CometActor
Hi guys, I've recently migrated some code which leverages ajax and comet quite heavily, from 1.1-M4 to 1.1-M8 and have found that the function binding for a rendered ajax element, bound to a template which is itself the target of another ajax element, rendered via a CometActor (a mouthful I know) - no longer works. Rendering the same ajax element via a template works, and previously worked via a CometActor in 1.1- M4. The javascript callback code (and it's associated GUID) is generated, and the ajax_request successfully hits jetty, but I'm assuming something related to the guid-function mapping is not occurring, as the function isn't invoked. I've distilled the problem to an example below: Template: lift:surround with=default at=content lift:TS.stuff / lift:comet type=MyActor / div id=whatever / /lift:surround Snippet: class TS { def stuff(in: NodeSeq): NodeSeq = a(()= { SetHtml(whatever, lift:TS.stuff2st:something//lift:TS.stuff2) }, Text(this works (via snippet))) def stuff2(in: NodeSeq): NodeSeq = bind(st, in, something - a (() = {println(clicked); Noop}, Text(click me))) } CometActor: class MyActor extends CometActor { //def render = SetHtml(whatever, lift:TS.stuff2st:something// lift:TS.stuff2) // works def render = a(()= { SetHtml(whatever, lift:TS.stuff2st:something//lift:TS.stuff2) }, Text(this doesn't (via comet actor))) } Can you give an indication of whether this change since M4 is intentional or if it will be working in future? Cheers, Chris -- 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.