[Lift] Re: Javascript Commands

2009-10-01 Thread Derek Chen-Becker
If you have a javascript function foo(a, b) where a is a String and b
is an integer then you can call that with

JE.Call(foo, one, 2)

for example. If you wanted to set some variable to the result of the
function, you could do:

JsCmds.CrVar(myVar, JE.Call(foo, one, 2))



Derek

On Wed, Sep 30, 2009 at 6:17 PM, sunanda sunanda.pa...@gmail.com wrote:


 Hi David,
 Thanks for your prompt reply.
 As a beginner I have started reading the book Exploring Lift.

 It says

 If you need to write large portions of JavaScript code for your
 pages, we recommend writing that code in
 pure JavaScript in an external file and then including that file in
 your pages. In particular, if you write your code as JavaScript
 functions, you can use the JE.Call class to execute those functions
 from your Lift code.

 I just want to know how can I use JE.Call function fro my external
 javascript file and also how to use JE abstractions like (JsFunc,
 ValById etc..)

 Could you please provide a simple example so that my understanding
 will be clear.

 Thanks
 Sunanda

 On Oct 1, 9:56 am, David Pollak feeder.of.the.be...@gmail.com wrote:
  Seehttp://demo.liftweb.net/ajax
  Specifically:
 
  var cnt = 0def doClicker(text: NodeSeq) =
  a(() = {cnt = cnt + 1; SetHtml(spanName, Text( cnt.toString))},
 text)
 
  It increments a counter.
 
  On Wed, Sep 30, 2009 at 4:50 PM, sunanda sunanda.pa...@gmail.com
 wrote:
 
   Hi,
   I am totally new to lift framework.
   Can any one give me a simple example of how to call a function form a
   javascript file and store the results
   in  scala variable.
 
   Thanks.
 
  --
  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: Javascript Commands

2009-10-01 Thread sunanda


Thanks Derek.
But I get the following errors:
found : net.liftweb.http.js.JE.Call
required: java.lang.String
x= JE.Call(foo,2)
^
C:\J\BrandNET\eclipse_workspace\GridXml_Lift2.0\src\main\scala\net
\irisinteractive\lift\grid\snippet\CreateGridConfigTable.scala:47:
error: value CrVar is not a member of object
net.liftweb.http.js.JsCmds
JsCmds.CrVar(myVar, JE.Call(foo, 2))


On Oct 2, 12:07 am, Derek Chen-Becker dchenbec...@gmail.com wrote:
 If you have a javascript function foo(a, b) where a is a String and b
 is an integer then you can call that with

 JE.Call(foo, one, 2)

 for example. If you wanted to set some variable to the result of the
 function, you could do:

 JsCmds.CrVar(myVar, JE.Call(foo, one, 2))

 Derek



 On Wed, Sep 30, 2009 at 6:17 PM, sunanda sunanda.pa...@gmail.com wrote:

  Hi David,
  Thanks for your prompt reply.
  As a beginner I have started reading the book Exploring Lift.

  It says

  If you need to write large portions of JavaScript code for your
  pages, we recommend writing that code in
  pure JavaScript in an external file and then including that file in
  your pages. In particular, if you write your code as JavaScript
  functions, you can use the JE.Call class to execute those functions
  from your Lift code.

  I just want to know how can I use JE.Call function fro my external
  javascript file and also how to use JE abstractions like (JsFunc,
  ValById etc..)

  Could you please provide a simple example so that my understanding
  will be clear.

  Thanks
  Sunanda

  On Oct 1, 9:56 am, David Pollak feeder.of.the.be...@gmail.com wrote:
   Seehttp://demo.liftweb.net/ajax
   Specifically:

   var cnt = 0    def doClicker(text: NodeSeq) =
       a(() = {cnt = cnt + 1; SetHtml(spanName, Text( cnt.toString))},
  text)

   It increments a counter.

   On Wed, Sep 30, 2009 at 4:50 PM, sunanda sunanda.pa...@gmail.com
  wrote:

Hi,
I am totally new to lift framework.
Can any one give me a simple example of how to call a function form a
javascript file and store the results
in  scala variable.

Thanks.

   --
   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- Hide quoted text -

 - Show quoted text -

--~--~-~--~~~---~--~~
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: Javascript Commands

2009-10-01 Thread Indrajit Raychaudhuri

That should read JsCmds.JsCrVar(...)

Cheers, Indrajit


On 02/10/09 4:39 AM, sunanda wrote:


 Thanks Derek.
 But I get the following errors:
 found : net.liftweb.http.js.JE.Call
 required: java.lang.String
 x= JE.Call(foo,2)
 ^
 C:\J\BrandNET\eclipse_workspace\GridXml_Lift2.0\src\main\scala\net
 \irisinteractive\lift\grid\snippet\CreateGridConfigTable.scala:47:
 error: value CrVar is not a member of object
 net.liftweb.http.js.JsCmds
 JsCmds.CrVar(myVar, JE.Call(foo, 2))


 On Oct 2, 12:07 am, Derek Chen-Beckerdchenbec...@gmail.com  wrote:
 If you have a javascript function foo(a, b) where a is a String and b
 is an integer then you can call that with

 JE.Call(foo, one, 2)

 for example. If you wanted to set some variable to the result of the
 function, you could do:

 JsCmds.CrVar(myVar, JE.Call(foo, one, 2))

 Derek



 On Wed, Sep 30, 2009 at 6:17 PM, sunandasunanda.pa...@gmail.com  wrote:

 Hi David,
 Thanks for your prompt reply.
 As a beginner I have started reading the book Exploring Lift.

 It says

 If you need to write large portions of JavaScript code for your
 pages, we recommend writing that code in
 pure JavaScript in an external file and then including that file in
 your pages. In particular, if you write your code as JavaScript
 functions, you can use the JE.Call class to execute those functions
 from your Lift code.

 I just want to know how can I use JE.Call function fro my external
 javascript file and also how to use JE abstractions like (JsFunc,
 ValById etc..)

 Could you please provide a simple example so that my understanding
 will be clear.

 Thanks
 Sunanda

 On Oct 1, 9:56 am, David Pollakfeeder.of.the.be...@gmail.com  wrote:
 Seehttp://demo.liftweb.net/ajax
 Specifically:

 var cnt = 0def doClicker(text: NodeSeq) =
  a(() =  {cnt = cnt + 1; SetHtml(spanName, Text( cnt.toString))},
 text)

 It increments a counter.

 On Wed, Sep 30, 2009 at 4:50 PM, sunandasunanda.pa...@gmail.com
 wrote:

 Hi,
 I am totally new to lift framework.
 Can any one give me a simple example of how to call a function form a
 javascript file and store the results
 in  scala variable.

 Thanks.

 --
 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- Hide quoted text -

 - Show quoted text -

 

--~--~-~--~~~---~--~~
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: Javascript Commands

2009-10-01 Thread Derek Chen-Becker
Oops, sorry about that. Also, can you show a little more of your code? I'm
not sure what you're trying to do with the assignment to x.

Derek

On Thu, Oct 1, 2009 at 10:18 PM, Indrajit Raychaudhuri
indraj...@gmail.comwrote:


 That should read JsCmds.JsCrVar(...)

 Cheers, Indrajit


 On 02/10/09 4:39 AM, sunanda wrote:
 
 
  Thanks Derek.
  But I get the following errors:
  found : net.liftweb.http.js.JE.Call
  required: java.lang.String
  x= JE.Call(foo,2)
  ^
  C:\J\BrandNET\eclipse_workspace\GridXml_Lift2.0\src\main\scala\net
  \irisinteractive\lift\grid\snippet\CreateGridConfigTable.scala:47:
  error: value CrVar is not a member of object
  net.liftweb.http.js.JsCmds
  JsCmds.CrVar(myVar, JE.Call(foo, 2))
 
 
  On Oct 2, 12:07 am, Derek Chen-Beckerdchenbec...@gmail.com  wrote:
  If you have a javascript function foo(a, b) where a is a String and
 b
  is an integer then you can call that with
 
  JE.Call(foo, one, 2)
 
  for example. If you wanted to set some variable to the result of the
  function, you could do:
 
  JsCmds.CrVar(myVar, JE.Call(foo, one, 2))
 
  Derek
 
 
 
  On Wed, Sep 30, 2009 at 6:17 PM, sunandasunanda.pa...@gmail.com
  wrote:
 
  Hi David,
  Thanks for your prompt reply.
  As a beginner I have started reading the book Exploring Lift.
 
  It says
 
  If you need to write large portions of JavaScript code for your
  pages, we recommend writing that code in
  pure JavaScript in an external file and then including that file in
  your pages. In particular, if you write your code as JavaScript
  functions, you can use the JE.Call class to execute those functions
  from your Lift code.
 
  I just want to know how can I use JE.Call function fro my external
  javascript file and also how to use JE abstractions like (JsFunc,
  ValById etc..)
 
  Could you please provide a simple example so that my understanding
  will be clear.
 
  Thanks
  Sunanda
 
  On Oct 1, 9:56 am, David Pollakfeeder.of.the.be...@gmail.com  wrote:
  Seehttp://demo.liftweb.net/ajax
  Specifically:
 
  var cnt = 0def doClicker(text: NodeSeq) =
   a(() =  {cnt = cnt + 1; SetHtml(spanName, Text( cnt.toString))},
  text)
 
  It increments a counter.
 
  On Wed, Sep 30, 2009 at 4:50 PM, sunandasunanda.pa...@gmail.com
  wrote:
 
  Hi,
  I am totally new to lift framework.
  Can any one give me a simple example of how to call a function form a
  javascript file and store the results
  in  scala variable.
 
  Thanks.
 
  --
  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- Hide quoted text -
 
  - Show quoted text -
 
  

 


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