[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

[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

[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

[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

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

[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

[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

[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

[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 

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

[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

[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

[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

[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