On Thu, May 3, 2012 at 1:57 AM, Šarūnas <sarunas.ri
...@gmail.com> wrote:
> Hello nafg,
> Thank you for your reply!
> Do you mean I should write it like this: JsVar("it").toJsCmd ?
> Now if I type 'a' and submit it outputs:
> - it
> - it
> instead of:
> - JsExp(it)
> - JsExp(it)
> I'm clearly still doing something wrong.
> Best regards,
> Šarūnas R.
> On Thursday, May 3, 2012 1:10:56 AM UTC+3, nafg wrote:
>> You have to write *theJsExp*.toJsCmd.
>> On Wed, May 2, 2012 at 7:45 AM, Šarūnas <sar...@gmail.com<sarunas.ri...@gmail.com>
>> > wrote:
>>> Hello,
>>> Sorry if this is not the right place to post a reply but I'm having
>>> the exact same problem with the exact same example. Can anyone give
>>> some suggestions how I could get the parameter "it" instead of string
>>> literal "JsExp(it)" here? It is really confusing.
>>> Thank you in advance,
>>> Šarūnas R.
>>> On Apr 24, 11:44 pm, Richard Dallaway <rich...@dallaway.com> wrote:
>>> > In caseithelps,itlooks like a smaller example exhibits the same
>>> > symptom. Viahttp://exploring.liftweb.**net/onepage/index.html#lst:Jx-
>>> **trivial-example<http://exploring.liftweb.net/onepage/index.html#lst:Jx-trivial-example>
>>> > Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server
>>> > VM, Java 1.6.0_31).
>>> > Type in expressions to have them evaluated.
>>> > Type :help for more information.
>>> > scala> import net.liftweb.http.js.Jx
>>> > import net.liftweb.http.js.Jx
>>> > scala> import net.liftweb.http.js.JE.JsVar
>>> > import net.liftweb.http.js.JE.JsVar
>>> > scala> val x = Jx(<li>{JsVar("it")}</li>)
>>> > x: net.liftweb.http.js.Jx = <jx><li>JsExp(it)</li></jx>
>>> > scala> x.toJs
>>> > res0: net.liftweb.http.js.JsExp =
>>> > JsExp(function(it) {var df = document.**createDocumentFragment();
>>> > var vF183656903091U1DD3G = document.createElement("li");
>>> > df.appendChild(**vF183656903091U1DD3G);
>>> > vF183656903091U1DD3G.**appendChild(document.**
>>> createTextNode("JsExp(it)"));;
>>> > return df;})
>>> > My understanding of the expectation: that final
>>> > document.createTextNode should referencing the Javascript function
>>> > parameter "it", not the literal Javascript string of "JsExp(it)".
>>> > Richard
>>> > On 24 April 2012 17:48, Diego Medina <di...@fmpwizard.com> wrote:
>>> > > Could you out together a sample
>>> > >https://www.assembla.com/**wiki/show/liftweb/Posting_**example_code<https://www.assembla.com/wiki/show/liftweb/Posting_example_code>
>>> > > application showing the problem?
>>> > > And would you be k not using all the js abstraction and use some
>>> > > regular javascript in there?
>>> > > I personally use a mix on most of my projects.
>>> > > Regards,
>>> > > Diego
>>> > > On Tue, Apr 24, 2012 at 8:17 AM, Dmitry Volosnykh
>>> > > <dmitry.volosn...@gmail.com> wrote:
>>> > >> Are there any gurus of Lift's Jx/Js classes?
>>> > >> There's no one having answered question on stackoverflow (http://
>>> > >> stackoverflow.com/questions/**10270433/lifts-javascript-**
>>> abstraction-<http://stackoverflow.com/questions/10270433/lifts-javascript-abstract...>
>>> > >> layer) as well...
>>> > >> On Apr 22, 10:04 pm, Dmitry Volosnykh <dmitry.volosn...@gmail.com>
>>> > >> wrote:
>>> > >>> I am trying to run the following example from "Exploring Lift" book
>>> > >>> (with small changes, i.e. I preferred CSS-binding over
>>> XML-binding):
>>> > >>> object Hello {
>>> > >>> import js.{JxMap, Jx, JsCmds, JE}
>>> > >>> import JE._
>>> > >>> import net.liftweb.http.SHtml._
>>> > >>> import net.liftweb.util.BindHelpers._
>>> > >>> import JsCmds._
>>> > >>> val names = "marius" :: "tyler" :: "derek" :: "dave" :: "jorge"
>>> ::
>>> > >>> "viktor" :: Nil
>>> > >>> def ajaxian =
>>> > >>> "#text" #> ajaxText("Type something", {value => {
>>> > >>> val matches = names.filter(e => e.indexOf(value) > -1)
>>> > >>> SetHtml("items_list", NodeSeq.Empty) &
>>> > >>> JsCrVar("items", JsArray(matches.map(Str(_)):_***)) &
>>> > >>> JsCrVar("func", Jx(<ul>{
>>> > >>> JxMap(JsVar("it"), Jx(<li>{JsVar("it")}</li>))
>>> > >>> }</ul>).toJs) &
>>> > >>> (ElemById("items_list") ~> JsFunc("appendChild", Call("func",
>>> > >>>JsVar("items"))))
>>> > >>> }})
>>> > >>> }
>>> > >>> But I keep getting a list of "JsExp(it)" items when rendered to an
>>> > >>> HTML page instead of names in the same-named list. There should be
>>> > >>> something wrong with line
>>> > >>> JxMap(JsVar("it"), Jx(<li>{JsVar("it")}</li>))
>>> > >>> Lift lacks of documentation on JavaScript abstraction layer and
>>> > >>> reading corresponding chapters in books and browsing the Lift's
>>> > >>> sources do not lead me to an understanding of what's going on. The
>>> > >>> only thing I could figure up to now is that Jx creates AnonFunc
>>> with
>>> > >>>itparameter but I can not convince myself into correct usage of
>>> > >>>JsVar("it") in the example provided by Derek in his book.
>>> > >> --
>>> > >> Lift, the simply functional web framework:http://liftweb.net
>>> > >> Code:http://github.com/lift
>>> > >> Discussion:http://groups.**google.com/group/liftweb<http://groups.google.com/group/liftweb>
>>> > >> Stuck? Help us help you:https://www.assembla.com/**
>>> wiki/show/liftweb/Posting_**example_code<https://www.assembla.com/wiki/show/liftweb/Posting_example_code>
>>> > > --
>>> > > Diego Medina
>>> > > Lift/Scala Developer
>>> > > di...@fmpwizard.com
>>> > >http://www.fmpwizard.com
>>> > > --
>>> > > Lift, the simply functional web framework:http://liftweb.net
>>> > > Code:http://github.com/lift
>>> > > Discussion:http://groups.**google.com/group/liftweb<http://groups.google.com/group/liftweb>
>>> > > Stuck? Help us help you:https://www.assembla.com/**
>>> wiki/show/liftweb/Posting_**example_code<https://www.assembla.com/wiki/show/liftweb/Posting_example_code>
>>> --
>>> Lift, the simply functional web framework: http://liftweb.net
>>> Code: http://github.com/lift
>>> Discussion: http://groups.google.com/**group/liftweb<http://groups.google.com/group/liftweb>
>>> Stuck? Help us help you: https://www.assembla.com/wiki/**
>>> show/liftweb/Posting_example_**code<https://www.assembla.com/wiki/show/liftweb/Posting_example_code>
>> --
> Lift, the simply functional web framework: http://liftweb.net
> Code: http://github.com/lift
> Discussion: http://groups.google.com/group/liftweb
> Stuck? Help us help you:
> https://www.assembla.com/wiki/show/liftweb/Posting_example_code