scala - In Lift, making a JObject with an inline function -


This is common in JavaScript, especially in jQuery, to call a function with a literal argument and the area of ​​that argument To be an inline anonymous function. Like this:

  $ (function () {$ ("# mylist"). Sort ({placeholder: "ui-state-highlight", stop: function () {warnings ('hello !);}}};});   

Is it possible to make such a call from the elevator? It's as far as I've found:

  " # JsonScript "# & gt; script (js.jquery.JqJsCmds.JqOnLoad (js.jquery.JqJE.Jq (" # mylist ") ~ & gt; JJEJSfank (" Sortable ", Jobised ( Jeffield ("Placeholder", Jestring ("U-State - Highlights")): Jeffield ("Stop", J.J.E. Phonique (JSCMG Alert ("Hello!")) :: Neil))))   

The compiler complains that AnonFunc is not a JValue which is absolutely correct: it is not But in Javascript, a function () {} call is a legal value for a literal object area. How can I lift it?

For the function body here The long-term goal is:

  SHtml.jsonCall (JE.Call ("JsFunction"), lift function _)    

Here's an answer that I have some time ago Sector was also someone who wanted to integrate with lift jquier Autocompletions, which use the same callback method:

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -