[Lift] Re: Help with using JSExp and JsCmd traits

2009-10-01 Thread glenn

David,

Excellent. This is exactly what I was looking for.

Thanks.

Glenn

On Sep 30, 4:54 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 JqHtml and JqEmptyAfter eagerly evaluate the NodeSeq on the server, so
 there's no way to get client-side JS execution in a NodeSeq.
 You can write something like:

 object MyJqText {
     def apply(content: JsExp) = new JsExp with JQueryRight with JQueryLeft {
       def toJsCmd = text(+content.toJsCmd+)
     }
   }

 So:

 JqId(item-save)  MyJqText(JsVar(this, id) +  has changed)



 On Wed, Sep 30, 2009 at 2:05 PM, glenn gl...@exmbly.com wrote:

  As I mentioned, I was looking for a way to translate this JavaScript

  $('#item-save').html(this.id + ' was toggled')

  into a JsCmd so I could coded it my snipped as AnonFunc(some jsCmd).

  I know I can just use JsRaw, but who in their right mind wants to
  write JavaScript
  if it can be avoided.

  Glenn

  On Sep 30, 1:20 pm, David Pollak feeder.of.the.be...@gmail.com
  wrote:
   On Wed, Sep 30, 2009 at 1:08 PM, glenn gl...@exmbly.com wrote:

David,

The problem with writting the NodeSeq as div{this.id} was toggled/
div)
is that it generates the following JavaScript:

function() {jQuery('#'+item-save).empty().after(div-1 was
toggled/div);

that is, Lift evaluates {this.id} in relation to the snippet, then
outputs the value
in the JavaScript - not the result I'm after.

   What are you after?  What is this in the context?

Glenn...

On Sep 30, 11:41 am, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Wed, Sep 30, 2009 at 11:36 AM, glenn gl...@exmbly.com wrote:

  David,

  I can't do this, AnonFunc(JqId(item-save)  JqEmptyAfter
  (divthis.id was
   toggled/div)) , if that's what you mean.

 That's not what I wrote.  Please look again at the curly braces
  around
the
 this.id:

 AnonFunc(JqId(item-save)  JqEmptyAfter(div{this.id}
 was toggled/div))

  This generates the following JavaScript:

  function() {jQuery('#'+item-save).empty().after(divthis.idwas
  toggled/div);

  and that won't do. What's needed is something more akin to:

  function() {jQuery('#'+item-save).empty().after(div +
  this.id +
  was toggled/div);

  So, I guess my question is how do I define a NodeSeq to accomplish
  this?

  Glenn

  On Sep 30, 10:40 am, David Pollak feeder.of.the.be...@gmail.com
  wrote:
   On Tue, Sep 29, 2009 at 1:22 PM, glenn gl...@exmbly.com wrote:

I'd like to converting the following

JsRaw(function() $('#item-save').html(this.id + ' was
toggled'))

into something more object-oriented, using JQuery support
  functions
in
Lift.

I've tried various combiniations, including this

AnonFunc(JqId(item-save)  JqEmptyAfter(div{JsRaw(this.id
  )}
was
toggled/div))

   AnonFunc(JqId(item-save)  JqEmptyAfter(div{this.id} was
   toggled/div))

   No reason to promote this.id into some JavaScript thing.  It's
  part
of
  the
   XML literal.  The XML literal is generated server-side as part of
  the
   JavaScript function.

but nothing seems to work. It just treats this.id as ordinary
text,
not as a Javascript variable.

Any ideas would be appreciated.

Glenn

   --
   Lift, the simply functional web frameworkhttp://liftweb.net
   Beginning Scalahttp://www.apress.com/book/view/1430219890
   Follow me:http://twitter.com/dpp
   Surf the harmonics

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Surf the harmonics

   --
   Lift, the simply functional web frameworkhttp://liftweb.net
   Beginning Scalahttp://www.apress.com/book/view/1430219890
   Follow me:http://twitter.com/dpp
   Surf the harmonics

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://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 liftweb@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] Re: Help with using JSExp and JsCmd traits

2009-10-01 Thread David Pollak
On Thu, Oct 1, 2009 at 8:25 AM, glenn gl...@exmbly.com wrote:


 David,

 Excellent. This is exactly what I was looking for.


Wow.  I think this is the first time I've actually helped you.  I'm sorry
I'm bad at understanding what you ask for.

More broadly, the JavaScript stuff in Lift is not magic.  It's just a bunch
of simple JavaScript that I and some of the other committers have used over
time.  I encourage the creation of your own JsCmd and JsExp components that
suit your project... and maybe even share them with the community.



 Thanks.

 Glenn

 On Sep 30, 4:54 pm, David Pollak feeder.of.the.be...@gmail.com
 wrote:
  JqHtml and JqEmptyAfter eagerly evaluate the NodeSeq on the server, so
  there's no way to get client-side JS execution in a NodeSeq.
  You can write something like:
 
  object MyJqText {
  def apply(content: JsExp) = new JsExp with JQueryRight with
 JQueryLeft {
def toJsCmd = text(+content.toJsCmd+)
  }
}
 
  So:
 
  JqId(item-save)  MyJqText(JsVar(this, id) +  has changed)
 
 
 
  On Wed, Sep 30, 2009 at 2:05 PM, glenn gl...@exmbly.com wrote:
 
   As I mentioned, I was looking for a way to translate this JavaScript
 
   $('#item-save').html(this.id + ' was toggled')
 
   into a JsCmd so I could coded it my snipped as AnonFunc(some jsCmd).
 
   I know I can just use JsRaw, but who in their right mind wants to
   write JavaScript
   if it can be avoided.
 
   Glenn
 
   On Sep 30, 1:20 pm, David Pollak feeder.of.the.be...@gmail.com
   wrote:
On Wed, Sep 30, 2009 at 1:08 PM, glenn gl...@exmbly.com wrote:
 
 David,
 
 The problem with writting the NodeSeq as div{this.id} was
 toggled/
 div)
 is that it generates the following JavaScript:
 
 function() {jQuery('#'+item-save).empty().after(div-1 was
 toggled/div);
 
 that is, Lift evaluates {this.id} in relation to the snippet, then
 outputs the value
 in the JavaScript - not the result I'm after.
 
What are you after?  What is this in the context?
 
 Glenn...
 
 On Sep 30, 11:41 am, David Pollak feeder.of.the.be...@gmail.com
 wrote:
  On Wed, Sep 30, 2009 at 11:36 AM, glenn gl...@exmbly.com
 wrote:
 
   David,
 
   I can't do this, AnonFunc(JqId(item-save)  JqEmptyAfter
   (divthis.id was
toggled/div)) , if that's what you mean.
 
  That's not what I wrote.  Please look again at the curly braces
   around
 the
  this.id:
 
  AnonFunc(JqId(item-save)  JqEmptyAfter(div{this.id}
  was toggled/div))
 
   This generates the following JavaScript:
 
   function()
 {jQuery('#'+item-save).empty().after(divthis.idwas
   toggled/div);
 
   and that won't do. What's needed is something more akin to:
 
   function() {jQuery('#'+item-save).empty().after(div +
   this.id +
   was toggled/div);
 
   So, I guess my question is how do I define a NodeSeq to
 accomplish
   this?
 
   Glenn
 
   On Sep 30, 10:40 am, David Pollak 
 feeder.of.the.be...@gmail.com
   wrote:
On Tue, Sep 29, 2009 at 1:22 PM, glenn gl...@exmbly.com
 wrote:
 
 I'd like to converting the following
 
 JsRaw(function() $('#item-save').html(this.id + ' was
 toggled'))
 
 into something more object-oriented, using JQuery support
   functions
 in
 Lift.
 
 I've tried various combiniations, including this
 
 AnonFunc(JqId(item-save)  JqEmptyAfter(div{JsRaw(
 this.id
   )}
 was
 toggled/div))
 
AnonFunc(JqId(item-save)  JqEmptyAfter(div{this.id}
 was
toggled/div))
 
No reason to promote this.id into some JavaScript thing.
  It's
   part
 of
   the
XML literal.  The XML literal is generated server-side as
 part of
   the
JavaScript function.
 
 but nothing seems to work. It just treats this.id as
 ordinary
 text,
 not as a Javascript variable.
 
 Any ideas would be appreciated.
 
 Glenn
 
--
Lift, the simply functional web frameworkhttp://liftweb.net
Beginning Scalahttp://www.apress.com/book/view/1430219890
Follow me:http://twitter.com/dpp
Surf the harmonics
 
  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Beginning Scalahttp://www.apress.com/book/view/1430219890
  Follow me:http://twitter.com/dpp
  Surf the harmonics
 
--
Lift, the simply functional web frameworkhttp://liftweb.net
Beginning Scalahttp://www.apress.com/book/view/1430219890
Follow me:http://twitter.com/dpp
Surf the harmonics
 
  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Beginning Scalahttp://www.apress.com/book/view/1430219890
  Follow me:http://twitter.com/dpp
  Surf the harmonics
 



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


[Lift] Re: Help with using JSExp and JsCmd traits

2009-10-01 Thread glenn

David,

This is off topic, but you always are a help. Your
thoughtful assistance on this discussion group either directly
resolves issues I'm
having with Lift, or leads me to rethink my strategy and explore new
avenues
I haven't thought of. At the very least, you force me to reframe many
of my
questions, so they can be answered.

Many times, I've thought of abandoning Lift for safer harbors, but
the help
from you and all on this group brings me back to the fold. I've still
got lots to
learn.

Glenn

On Oct 1, 8:29 am, David Pollak feeder.of.the.be...@gmail.com wrote:
 On Thu, Oct 1, 2009 at 8:25 AM, glenn gl...@exmbly.com wrote:

  David,

  Excellent. This is exactly what I was looking for.

 Wow.  I think this is the first time I've actually helped you.  I'm sorry
 I'm bad at understanding what you ask for.

 More broadly, the JavaScript stuff in Lift is not magic.  It's just a bunch
 of simple JavaScript that I and some of the other committers have used over
 time.  I encourage the creation of your own JsCmd and JsExp components that
 suit your project... and maybe even share them with the community.





  Thanks.

  Glenn

  On Sep 30, 4:54 pm, David Pollak feeder.of.the.be...@gmail.com
  wrote:
   JqHtml and JqEmptyAfter eagerly evaluate the NodeSeq on the server, so
   there's no way to get client-side JS execution in a NodeSeq.
   You can write something like:

   object MyJqText {
       def apply(content: JsExp) = new JsExp with JQueryRight with
  JQueryLeft {
         def toJsCmd = text(+content.toJsCmd+)
       }
     }

   So:

   JqId(item-save)  MyJqText(JsVar(this, id) +  has changed)

   On Wed, Sep 30, 2009 at 2:05 PM, glenn gl...@exmbly.com wrote:

As I mentioned, I was looking for a way to translate this JavaScript

$('#item-save').html(this.id + ' was toggled')

into a JsCmd so I could coded it my snipped as AnonFunc(some jsCmd).

I know I can just use JsRaw, but who in their right mind wants to
write JavaScript
if it can be avoided.

Glenn

On Sep 30, 1:20 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Wed, Sep 30, 2009 at 1:08 PM, glenn gl...@exmbly.com wrote:

  David,

  The problem with writting the NodeSeq as div{this.id} was
  toggled/
  div)
  is that it generates the following JavaScript:

  function() {jQuery('#'+item-save).empty().after(div-1 was
  toggled/div);

  that is, Lift evaluates {this.id} in relation to the snippet, then
  outputs the value
  in the JavaScript - not the result I'm after.

 What are you after?  What is this in the context?

  Glenn...

  On Sep 30, 11:41 am, David Pollak feeder.of.the.be...@gmail.com
  wrote:
   On Wed, Sep 30, 2009 at 11:36 AM, glenn gl...@exmbly.com
  wrote:

David,

I can't do this, AnonFunc(JqId(item-save)  JqEmptyAfter
(divthis.id was
 toggled/div)) , if that's what you mean.

   That's not what I wrote.  Please look again at the curly braces
around
  the
   this.id:

   AnonFunc(JqId(item-save)  JqEmptyAfter(div{this.id}
   was toggled/div))

This generates the following JavaScript:

function()
  {jQuery('#'+item-save).empty().after(divthis.idwas
toggled/div);

and that won't do. What's needed is something more akin to:

function() {jQuery('#'+item-save).empty().after(div +
this.id +
was toggled/div);

So, I guess my question is how do I define a NodeSeq to
  accomplish
this?

Glenn

On Sep 30, 10:40 am, David Pollak 
  feeder.of.the.be...@gmail.com
wrote:
 On Tue, Sep 29, 2009 at 1:22 PM, glenn gl...@exmbly.com
  wrote:

  I'd like to converting the following

  JsRaw(function() $('#item-save').html(this.id + ' was
  toggled'))

  into something more object-oriented, using JQuery support
functions
  in
  Lift.

  I've tried various combiniations, including this

  AnonFunc(JqId(item-save)  JqEmptyAfter(div{JsRaw(
  this.id
)}
  was
  toggled/div))

 AnonFunc(JqId(item-save)  JqEmptyAfter(div{this.id}
  was
 toggled/div))

 No reason to promote this.id into some JavaScript thing.
   It's
part
  of
the
 XML literal.  The XML literal is generated server-side as
  part of
the
 JavaScript function.

  but nothing seems to work. It just treats this.id as
  ordinary
  text,
  not as a Javascript variable.

  Any ideas would be appreciated.

  Glenn

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Surf the harmonics

   --
   Lift, the simply functional web frameworkhttp://liftweb.net
   Beginning 

[Lift] Re: Help with using JSExp and JsCmd traits

2009-09-30 Thread David Pollak
On Tue, Sep 29, 2009 at 1:22 PM, glenn gl...@exmbly.com wrote:


 I'd like to converting the following

 JsRaw(function() $('#item-save').html(this.id + ' was
 toggled'))

 into something more object-oriented, using JQuery support functions in
 Lift.

 I've tried various combiniations, including this

 AnonFunc(JqId(item-save)  JqEmptyAfter(div{JsRaw(this.id)} was
 toggled/div))


AnonFunc(JqId(item-save)  JqEmptyAfter(div{this.id} was
toggled/div))

No reason to promote this.id into some JavaScript thing.  It's part of the
XML literal.  The XML literal is generated server-side as part of the
JavaScript function.




 but nothing seems to work. It just treats this.id as ordinary text,
 not as a Javascript variable.

 Any ideas would be appreciated.

 Glenn
 



-- 
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 liftweb@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] Re: Help with using JSExp and JsCmd traits

2009-09-30 Thread David Pollak
On Wed, Sep 30, 2009 at 11:36 AM, glenn gl...@exmbly.com wrote:


 David,

 I can't do this, AnonFunc(JqId(item-save)  JqEmptyAfter
 (divthis.id was
  toggled/div)) , if that's what you mean.


That's not what I wrote.  Please look again at the curly braces around the
this.id:

AnonFunc(JqId(item-save)  JqEmptyAfter(div{this.id}
was toggled/div))



 This generates the following JavaScript:

 function() {jQuery('#'+item-save).empty().after(divthis.id was
 toggled/div);

 and that won't do. What's needed is something more akin to:

 function() {jQuery('#'+item-save).empty().after(div + this.id +
 was toggled/div);

 So, I guess my question is how do I define a NodeSeq to accomplish
 this?

 Glenn



 On Sep 30, 10:40 am, David Pollak feeder.of.the.be...@gmail.com
 wrote:
  On Tue, Sep 29, 2009 at 1:22 PM, glenn gl...@exmbly.com wrote:
 
   I'd like to converting the following
 
   JsRaw(function() $('#item-save').html(this.id + ' was
   toggled'))
 
   into something more object-oriented, using JQuery support functions in
   Lift.
 
   I've tried various combiniations, including this
 
   AnonFunc(JqId(item-save)  JqEmptyAfter(div{JsRaw(this.id)} was
   toggled/div))
 
  AnonFunc(JqId(item-save)  JqEmptyAfter(div{this.id} was
  toggled/div))
 
  No reason to promote this.id into some JavaScript thing.  It's part of
 the
  XML literal.  The XML literal is generated server-side as part of the
  JavaScript function.
 
 
 
   but nothing seems to work. It just treats this.id as ordinary text,
   not as a Javascript variable.
 
   Any ideas would be appreciated.
 
   Glenn
 
  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Beginning Scalahttp://www.apress.com/book/view/1430219890
  Follow me:http://twitter.com/dpp
  Surf the harmonics
 



-- 
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 liftweb@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] Re: Help with using JSExp and JsCmd traits

2009-09-30 Thread glenn

David,

The problem with writting the NodeSeq as div{this.id} was toggled/
div)
is that it generates the following JavaScript:

function() {jQuery('#'+item-save).empty().after(div-1 was
toggled/div);

that is, Lift evaluates {this.id} in relation to the snippet, then
outputs the value
in the JavaScript - not the result I'm after.

Glenn...

On Sep 30, 11:41 am, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Wed, Sep 30, 2009 at 11:36 AM, glenn gl...@exmbly.com wrote:

  David,

  I can't do this, AnonFunc(JqId(item-save)  JqEmptyAfter
  (divthis.id was
   toggled/div)) , if that's what you mean.

 That's not what I wrote.  Please look again at the curly braces around the
 this.id:

 AnonFunc(JqId(item-save)  JqEmptyAfter(div{this.id}
 was toggled/div))





  This generates the following JavaScript:

  function() {jQuery('#'+item-save).empty().after(divthis.id was
  toggled/div);

  and that won't do. What's needed is something more akin to:

  function() {jQuery('#'+item-save).empty().after(div + this.id +
  was toggled/div);

  So, I guess my question is how do I define a NodeSeq to accomplish
  this?

  Glenn

  On Sep 30, 10:40 am, David Pollak feeder.of.the.be...@gmail.com
  wrote:
   On Tue, Sep 29, 2009 at 1:22 PM, glenn gl...@exmbly.com wrote:

I'd like to converting the following

JsRaw(function() $('#item-save').html(this.id + ' was
toggled'))

into something more object-oriented, using JQuery support functions in
Lift.

I've tried various combiniations, including this

AnonFunc(JqId(item-save)  JqEmptyAfter(div{JsRaw(this.id)} was
toggled/div))

   AnonFunc(JqId(item-save)  JqEmptyAfter(div{this.id} was
   toggled/div))

   No reason to promote this.id into some JavaScript thing.  It's part of
  the
   XML literal.  The XML literal is generated server-side as part of the
   JavaScript function.

but nothing seems to work. It just treats this.id as ordinary text,
not as a Javascript variable.

Any ideas would be appreciated.

Glenn

   --
   Lift, the simply functional web frameworkhttp://liftweb.net
   Beginning Scalahttp://www.apress.com/book/view/1430219890
   Follow me:http://twitter.com/dpp
   Surf the harmonics

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://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 liftweb@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] Re: Help with using JSExp and JsCmd traits

2009-09-30 Thread David Pollak
On Wed, Sep 30, 2009 at 1:08 PM, glenn gl...@exmbly.com wrote:


 David,

 The problem with writting the NodeSeq as div{this.id} was toggled/
 div)
 is that it generates the following JavaScript:

 function() {jQuery('#'+item-save).empty().after(div-1 was
 toggled/div);

 that is, Lift evaluates {this.id} in relation to the snippet, then
 outputs the value
 in the JavaScript - not the result I'm after.


What are you after?  What is this in the context?



 Glenn...

 On Sep 30, 11:41 am, David Pollak feeder.of.the.be...@gmail.com
 wrote:
  On Wed, Sep 30, 2009 at 11:36 AM, glenn gl...@exmbly.com wrote:
 
   David,
 
   I can't do this, AnonFunc(JqId(item-save)  JqEmptyAfter
   (divthis.id was
toggled/div)) , if that's what you mean.
 
  That's not what I wrote.  Please look again at the curly braces around
 the
  this.id:
 
  AnonFunc(JqId(item-save)  JqEmptyAfter(div{this.id}
  was toggled/div))
 
 
 
 
 
   This generates the following JavaScript:
 
   function() {jQuery('#'+item-save).empty().after(divthis.id was
   toggled/div);
 
   and that won't do. What's needed is something more akin to:
 
   function() {jQuery('#'+item-save).empty().after(div + this.id +
   was toggled/div);
 
   So, I guess my question is how do I define a NodeSeq to accomplish
   this?
 
   Glenn
 
   On Sep 30, 10:40 am, David Pollak feeder.of.the.be...@gmail.com
   wrote:
On Tue, Sep 29, 2009 at 1:22 PM, glenn gl...@exmbly.com wrote:
 
 I'd like to converting the following
 
 JsRaw(function() $('#item-save').html(this.id + ' was
 toggled'))
 
 into something more object-oriented, using JQuery support functions
 in
 Lift.
 
 I've tried various combiniations, including this
 
 AnonFunc(JqId(item-save)  JqEmptyAfter(div{JsRaw(this.id)}
 was
 toggled/div))
 
AnonFunc(JqId(item-save)  JqEmptyAfter(div{this.id} was
toggled/div))
 
No reason to promote this.id into some JavaScript thing.  It's part
 of
   the
XML literal.  The XML literal is generated server-side as part of the
JavaScript function.
 
 but nothing seems to work. It just treats this.id as ordinary
 text,
 not as a Javascript variable.
 
 Any ideas would be appreciated.
 
 Glenn
 
--
Lift, the simply functional web frameworkhttp://liftweb.net
Beginning Scalahttp://www.apress.com/book/view/1430219890
Follow me:http://twitter.com/dpp
Surf the harmonics
 
  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Beginning Scalahttp://www.apress.com/book/view/1430219890
  Follow me:http://twitter.com/dpp
  Surf the harmonics
 



-- 
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 liftweb@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] Re: Help with using JSExp and JsCmd traits

2009-09-29 Thread Ross Mellgren

Try JsVar(this, id) or JsRaw(this.id)

-Ross

On Sep 29, 2009, at 4:22 PM, glenn wrote:


 I'd like to converting the following

 JsRaw(function() $('#item-save').html(this.id + ' was
 toggled'))

 into something more object-oriented, using JQuery support functions in
 Lift.

 I've tried various combiniations, including this

 AnonFunc(JqId(item-save)  JqEmptyAfter(div{JsRaw(this.id)} was
 toggled/div))

 but nothing seems to work. It just treats this.id as ordinary text,
 not as a Javascript variable.

 Any ideas would be appreciated.

 Glenn
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@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] Re: Help with using JSExp and JsCmd traits

2009-09-29 Thread glenn

Hi, Ross,

Unfornately, all of these just result in:

function() {jQuery('#'+item-save).empty().after(divthis.id was
toggled/div);}

They simply treat this.id as part of the passed in NodeSeq,
divthis.id was toggled/div. I need it
to output divthis.id + was toggled/div.

Glenn




On Sep 29, 1:46 pm, Ross Mellgren dri...@gmail.com wrote:
 Try JsVar(this, id) or JsRaw(this.id)

 -Ross

 On Sep 29, 2009, at 4:22 PM, glenn wrote:



  I'd like to converting the following

  JsRaw(function() $('#item-save').html(this.id + ' was
  toggled'))

  into something more object-oriented, using JQuery support functions in
  Lift.

  I've tried various combiniations, including this

  AnonFunc(JqId(item-save)  JqEmptyAfter(div{JsRaw(this.id)} was
  toggled/div))

  but nothing seems to work. It just treats this.id as ordinary text,
  not as a Javascript variable.

  Any ideas would be appreciated.

  Glenn
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@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] Re: Help with using JSExp and JsCmd traits

2009-09-29 Thread Naftoli Gugenheim

Well the compiler is trying to convert your JsRaw into a NodeSeq, because 
that's what happens to anything inside an xml literal. It probably uses 
toString.
I can't tell you how to do it correctly because I'm not familiar with Lift's 
javascript functionality.


-
glenngl...@exmbly.com wrote:


Hi, Ross,

Unfornately, all of these just result in:

function() {jQuery('#'+item-save).empty().after(divthis.id was
toggled/div);}

They simply treat this.id as part of the passed in NodeSeq,
divthis.id was toggled/div. I need it
to output divthis.id + was toggled/div.

Glenn




On Sep 29, 1:46 pm, Ross Mellgren dri...@gmail.com wrote:
 Try JsVar(this, id) or JsRaw(this.id)

 -Ross

 On Sep 29, 2009, at 4:22 PM, glenn wrote:



  I'd like to converting the following

  JsRaw(function() $('#item-save').html(this.id + ' was
  toggled'))

  into something more object-oriented, using JQuery support functions in
  Lift.

  I've tried various combiniations, including this

  AnonFunc(JqId(item-save)  JqEmptyAfter(div{JsRaw(this.id)} was
  toggled/div))

  but nothing seems to work. It just treats this.id as ordinary text,
  not as a Javascript variable.

  Any ideas would be appreciated.

  Glenn


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@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] Re: Help with using JSExp and JsCmd traits

2009-09-29 Thread Ross Mellgren

Oh I'm sorry, I got tunnel vision and did not read the rest of your  
code. You'll not be able to do quite what you want, since this.id is  
on the javascript side and the NodeSeq is on the server side.

If you really want this.id within that div, I think you'll have to  
construct or modify the div on the JS side. I rummaged through the  
Lift jQuery docs and I couldn't find something that will append/inject  
to a JQueryLeft (such as JqId) but using a JsExp and not a fixed  
NodeSeq. This is not to say there isn't such a thing, just that I  
couldn't find it. Of course, you can whip this up using the lower  
level javascript stuff:

AnonFunc(JqId(item-save) ~
  JsFunc(empty) ~
  JsFunc(after, Call(jQuery, div was toggled/div) ~
  JsFunc(prepend, JsVar(this, id

Of course, at that point I'd just say it might be a better idea to  
write the JavaScript directly, since this expands to

$(#item-save).empty().after($(div was toggled/div).prepend 
(this.id));

-Ross


On Sep 29, 2009, at 5:22 PM, glenn wrote:


 Hi, Ross,

 Unfornately, all of these just result in:

 function() {jQuery('#'+item-save).empty().after(divthis.id was
 toggled/div);}

 They simply treat this.id as part of the passed in NodeSeq,
 divthis.id was toggled/div. I need it
 to output divthis.id + was toggled/div.

 Glenn




 On Sep 29, 1:46 pm, Ross Mellgren dri...@gmail.com wrote:
 Try JsVar(this, id) or JsRaw(this.id)

 -Ross

 On Sep 29, 2009, at 4:22 PM, glenn wrote:



 I'd like to converting the following

 JsRaw(function() $('#item-save').html(this.id + ' was
 toggled'))

 into something more object-oriented, using JQuery support  
 functions in
 Lift.

 I've tried various combiniations, including this

 AnonFunc(JqId(item-save)  JqEmptyAfter(div{JsRaw(this.id)} was
 toggled/div))

 but nothing seems to work. It just treats this.id as ordinary text,
 not as a Javascript variable.

 Any ideas would be appreciated.

 Glenn
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@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] Re: Help with using JSExp and JsCmd traits

2009-09-29 Thread glenn

Ross,

I think you and I  came to same conclusion. Writing it as raw
JavaScript, as I
did initially, seems the only way I could find to do this. FYI, where
I was using this
was with the TreeView widget. There, toggle takes an anonymous
function, and
this is an implicit parameter, denoting the Tree selected.

val func = JsRaw(function() $('#item-save').html(this.id + ' was
toggled'))
TreeView(tree, JsObj((persist, location),(toggle,  func)),
loadTree, loadNode)


I was hoping for a more functional way to write func, in order to do
more complex processing on the client.

Glenn



On Sep 29, 2:55 pm, Ross Mellgren dri...@gmail.com wrote:
 Oh I'm sorry, I got tunnel vision and did not read the rest of your  
 code. You'll not be able to do quite what you want, since this.id is  
 on the javascript side and the NodeSeq is on the server side.

 If you really want this.id within that div, I think you'll have to  
 construct or modify the div on the JS side. I rummaged through the  
 Lift jQuery docs and I couldn't find something that will append/inject  
 to a JQueryLeft (such as JqId) but using a JsExp and not a fixed  
 NodeSeq. This is not to say there isn't such a thing, just that I  
 couldn't find it. Of course, you can whip this up using the lower  
 level javascript stuff:

 AnonFunc(JqId(item-save) ~
           JsFunc(empty) ~
           JsFunc(after, Call(jQuery, div was toggled/div) ~
                           JsFunc(prepend, JsVar(this, id

 Of course, at that point I'd just say it might be a better idea to  
 write the JavaScript directly, since this expands to

 $(#item-save).empty().after($(div was toggled/div).prepend
 (this.id));

 -Ross

 On Sep 29, 2009, at 5:22 PM, glenn wrote:



  Hi, Ross,

  Unfornately, all of these just result in:

  function() {jQuery('#'+item-save).empty().after(divthis.id was
  toggled/div);}

  They simply treat this.id as part of the passed in NodeSeq,
  divthis.id was toggled/div. I need it
  to output divthis.id + was toggled/div.

  Glenn

  On Sep 29, 1:46 pm, Ross Mellgren dri...@gmail.com wrote:
  Try JsVar(this, id) or JsRaw(this.id)

  -Ross

  On Sep 29, 2009, at 4:22 PM, glenn wrote:

  I'd like to converting the following

  JsRaw(function() $('#item-save').html(this.id + ' was
  toggled'))

  into something more object-oriented, using JQuery support  
  functions in
  Lift.

  I've tried various combiniations, including this

  AnonFunc(JqId(item-save)  JqEmptyAfter(div{JsRaw(this.id)} was
  toggled/div))

  but nothing seems to work. It just treats this.id as ordinary text,
  not as a Javascript variable.

  Any ideas would be appreciated.

  Glenn
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@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] Re: Help with using JSExp and JsCmd traits

2009-09-29 Thread Naftoli Gugenheim

Maybe write javascript code that gets all its variables by calling functions. 
Then supply those functions as Lift JsXX. This way you can supply values from 
Lift but the javascript program is written in javascript.


-
glenngl...@exmbly.com wrote:


Ross,

I think you and I  came to same conclusion. Writing it as raw
JavaScript, as I
did initially, seems the only way I could find to do this. FYI, where
I was using this
was with the TreeView widget. There, toggle takes an anonymous
function, and
this is an implicit parameter, denoting the Tree selected.

val func = JsRaw(function() $('#item-save').html(this.id + ' was
toggled'))
TreeView(tree, JsObj((persist, location),(toggle,  func)),
loadTree, loadNode)


I was hoping for a more functional way to write func, in order to do
more complex processing on the client.

Glenn



On Sep 29, 2:55 pm, Ross Mellgren dri...@gmail.com wrote:
 Oh I'm sorry, I got tunnel vision and did not read the rest of your  
 code. You'll not be able to do quite what you want, since this.id is  
 on the javascript side and the NodeSeq is on the server side.

 If you really want this.id within that div, I think you'll have to  
 construct or modify the div on the JS side. I rummaged through the  
 Lift jQuery docs and I couldn't find something that will append/inject  
 to a JQueryLeft (such as JqId) but using a JsExp and not a fixed  
 NodeSeq. This is not to say there isn't such a thing, just that I  
 couldn't find it. Of course, you can whip this up using the lower  
 level javascript stuff:

 AnonFunc(JqId(item-save) ~
           JsFunc(empty) ~
           JsFunc(after, Call(jQuery, div was toggled/div) ~
                           JsFunc(prepend, JsVar(this, id

 Of course, at that point I'd just say it might be a better idea to  
 write the JavaScript directly, since this expands to

 $(#item-save).empty().after($(div was toggled/div).prepend
 (this.id));

 -Ross

 On Sep 29, 2009, at 5:22 PM, glenn wrote:



  Hi, Ross,

  Unfornately, all of these just result in:

  function() {jQuery('#'+item-save).empty().after(divthis.id was
  toggled/div);}

  They simply treat this.id as part of the passed in NodeSeq,
  divthis.id was toggled/div. I need it
  to output divthis.id + was toggled/div.

  Glenn

  On Sep 29, 1:46 pm, Ross Mellgren dri...@gmail.com wrote:
  Try JsVar(this, id) or JsRaw(this.id)

  -Ross

  On Sep 29, 2009, at 4:22 PM, glenn wrote:

  I'd like to converting the following

  JsRaw(function() $('#item-save').html(this.id + ' was
  toggled'))

  into something more object-oriented, using JQuery support  
  functions in
  Lift.

  I've tried various combiniations, including this

  AnonFunc(JqId(item-save)  JqEmptyAfter(div{JsRaw(this.id)} was
  toggled/div))

  but nothing seems to work. It just treats this.id as ordinary text,
  not as a Javascript variable.

  Any ideas would be appreciated.

  Glenn


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@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] Re: Help with using JSExp and JsCmd traits

2009-09-29 Thread Ross Mellgren

I'm sure opinions vary, but my personal preference in general is to  
implement JavaScript in JavaScript as a linked .js file and leave the  
HTML/XML generation in the server and not mix the two terribly much  
unless it's simple or there's a compelling reason.

What do you mean by more functional?

-Ross

On Sep 29, 2009, at 6:23 PM, glenn wrote:


 Ross,

 I think you and I  came to same conclusion. Writing it as raw
 JavaScript, as I
 did initially, seems the only way I could find to do this. FYI, where
 I was using this
 was with the TreeView widget. There, toggle takes an anonymous
 function, and
 this is an implicit parameter, denoting the Tree selected.

 val func = JsRaw(function() $('#item-save').html(this.id + ' was
 toggled'))
 TreeView(tree, JsObj((persist, location),(toggle,  func)),
 loadTree, loadNode)


 I was hoping for a more functional way to write func, in order to do
 more complex processing on the client.

 Glenn



 On Sep 29, 2:55 pm, Ross Mellgren dri...@gmail.com wrote:
 Oh I'm sorry, I got tunnel vision and did not read the rest of your
 code. You'll not be able to do quite what you want, since this.id is
 on the javascript side and the NodeSeq is on the server side.

 If you really want this.id within that div, I think you'll have to
 construct or modify the div on the JS side. I rummaged through the
 Lift jQuery docs and I couldn't find something that will append/ 
 inject
 to a JQueryLeft (such as JqId) but using a JsExp and not a fixed
 NodeSeq. This is not to say there isn't such a thing, just that I
 couldn't find it. Of course, you can whip this up using the lower
 level javascript stuff:

 AnonFunc(JqId(item-save) ~
   JsFunc(empty) ~
   JsFunc(after, Call(jQuery, div was toggled/div)  
 ~
   JsFunc(prepend, JsVar(this, id

 Of course, at that point I'd just say it might be a better idea to
 write the JavaScript directly, since this expands to

 $(#item-save).empty().after($(div was toggled/div).prepend
 (this.id));

 -Ross

 On Sep 29, 2009, at 5:22 PM, glenn wrote:



 Hi, Ross,

 Unfornately, all of these just result in:

 function() {jQuery('#'+item-save).empty().after(divthis.id was
 toggled/div);}

 They simply treat this.id as part of the passed in NodeSeq,
 divthis.id was toggled/div. I need it
 to output divthis.id + was toggled/div.

 Glenn

 On Sep 29, 1:46 pm, Ross Mellgren dri...@gmail.com wrote:
 Try JsVar(this, id) or JsRaw(this.id)

 -Ross

 On Sep 29, 2009, at 4:22 PM, glenn wrote:

 I'd like to converting the following

 JsRaw(function() $('#item-save').html(this.id + ' was
 toggled'))

 into something more object-oriented, using JQuery support
 functions in
 Lift.

 I've tried various combiniations, including this

 AnonFunc(JqId(item-save)  JqEmptyAfter(div{JsRaw(this.id)}  
 was
 toggled/div))

 but nothing seems to work. It just treats this.id as ordinary  
 text,
 not as a Javascript variable.

 Any ideas would be appreciated.

 Glenn
 


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