On Tue, Mar 2, 2010 at 11:07 AM, Rick R <[email protected]> wrote:
> I have a pair of templates which rely on both a Snippet and a
> CometActor. There appears to be a "dependency injection"
Dependency injection is an entirely different concept. Lift rewrites the
page as it goes out to insure comet and ajax support.
> process of
> sorts where lift_page is defined and liftAjax.js is included. However,
> it looks like the list of things is being included in reverse order.
>
What do you mean "reverse order"? Are you seeing an actual error? Is
something actually failing?
All of the stuff in Lift is (or at least should be) invoked only after the
page load is complete.
> The results seem to be the same whether I just return a NodeSeq from
> CometActor.render or if I return a RenderOut defined with NodeSeq and
> JsCmd.
>
> I'm not doing anything too crazy, I do Rewrite urls for the pages used
> by the cometactors, but it's pretty standard.
> (On a side note, is there any way to get GET params from a Rewrite to
> the render function in a CometActor?
You can't. CometActors are not rendered in response to an HTTP request and
have no access to specific request state.
> , I tried a sessionVar but it
> didn't work. What I ended up doing was getting the param in a snippet.
> Setting it as a js variable on the page, then having the js use that
> value to make a JsonCmd to the cometActor, it should work provided I
> can fix the code represented below)
>
>
> For example: (my comments -- inline)
>
> -- This is the start of the template: adminchat.html
>
> <h2>Welcome to The Interview Tool.</h2>
> <p>
> <div id="F1040260232478N4M_outer" style="display: inline"><div
> id="F1040260232478N4M" style="display: inline"><div>
> <p><span id="info"></span></p>
> <p> <!-- A place to put stuff -->
>
> -- the following is the result of including : Script(JsonInCode) from
> render in my CometActor. This makes sense that we need to define the
> callback before using it. Note, however, that it's referencing
> liftAjax.lift but we haven't included liftAjax.js yet.
>
> <script type="text/javascript">
> // <![CDATA[
> /* JSON Func Other $$ F104026023248133W */function
> F104026023248133W(obj)
> {liftAjax.lift_ajaxHandler('F104026023248133W='+
> encodeURIComponent(JSON.stringify(obj)), null,null);}
> // ]]>
>
> </script>
> <input type="textarea"
> onkeypress="processKeyPress(event.which, function(a)
> {F104026023248133W({'command': "pressed", 'params':a});})"
> id="txt1" />
> </p>
> </div><script type="text/javascript">
> // <![CDATA[
>
> F104026023248133W({'command': "connect", 'params':chatKey});
>
> -- okay.. we define this function again, I'm not sure why and I didn't
> ask it to, but no real harm done.
>
> /* JSON Func Other $$ F104026023248133W */function
> F104026023248133W(obj)
> {liftAjax.lift_ajaxHandler('F104026023248133W='+
> encodeURIComponent(JSON.stringify(obj)), null,null);}
> // ]]>
> </script></div><script type="text/javascript">
> // <![CDATA[
> var destroy_F1040260232478N4M = function() {}
> // ]]>
> </script></div>
>
> -- this is the end of the output from the CometACtor
>
> </p>
>
> -- this is the end of output from the template.
>
> </div>
>
> <hr />
> </div>
>
> -- this should be the end of output from default.html, but I'm
> guessing this is where stuff gets merged in.
> -- Here we include liftAjax, it's a bit late, but it's still wrong
> because it relies on lift_page.
>
> <script type="text/javascript" src="/ajax_request/liftAjax.js"></script>
> <script type="text/javascript"
> src="/comet_request/xkvbzq4ueltw/cometAjax.js"></script>
>
> -- here's where we finally define the vars needed by liftAjax et al.
>
> <script type="text/javascript">
> // <![CDATA[
> var lift_toWatch = {"F1040260232478N4M": 1040260232480};
> // ]]>
> </script>
> <script type="text/javascript">
> // <![CDATA[
>
> var lift_page = "F1040260232477ZYH";
> // ]]>
> </script></body>
> </html>
>
> --
> 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]<liftweb%[email protected]>
> .
> 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 [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.