[Lift] Re: slow down ajax?
Short story - after a fresh start with your instructions... all is well. I actually just downloaded the zip file into a liftweb temp directory, then entered that and ran mvn as you said. After a huge compile, I changed all 3 of my Lift references in the existing project pom.xml to '1.1-SNAPSHOT' (which may have been a problem on my last attempt), and jetty started perfectly. So, now I will delve back into the mechanics of my program, and tinker along. Thanks for your help, and stay tuned for the next exciting episode... Lift is fun! On Aug 19, 10:42 pm, marius d. marius.dan...@gmail.com wrote: Or just checkout from git master and do a mvn clean:clean install Trust me it's all there :) Br's, Marius On Aug 20, 8:15 am, Naftoli Gugenheim naftoli...@gmail.com wrote: Are you using maven to compile? Delete any earlier jar so you rule out that possibility. Also, if you turn on debug output in maven (-X) it might tell you the path that it's using to invoke the compiler so you can see which jar it's using if any. - g-mangregor...@gmail.com wrote: Well, I went down the rabbit hole on a quest for 1.1-SNAPSHOT - It is not visible, even though my pom points to it, and the .m2 repository shows a directory for it. .m2\repository\net\liftweb\lift-archetype-basic\1.1-SNAPSHOT Bottom line is : src\main\scala\bootstrap\liftweb\Boot.scala:11: error: value provider is not a member of package net.liftweb.http import http.provider._ and: error: wrong number of arguments for method ajaxText: (String,(String) = net.liftweb.http.js.JsCmd)scala.xml.Elem So Lift can't see the new stuff, and I also can't get an archetype created using the 1.1-SNAPSHOT, so I will keep hacking unless you have some further guidance for me. On Aug 19, 12:20 pm, marius d. marius.dan...@gmail.com wrote: Please use Lift 1.1-SNAPSHOT Br's, Marius On Aug 19, 10:06 pm, g-man gregor...@gmail.com wrote: I quoted the def from net.liftweb.http.SHtml in: http://scala-tools.org/scaladocs/liftweb/1.0/ and when I tried the other version, my complier did not accept the extra param. That's why I thought I had to override something... Is there a newer version I should be using? On Aug 18, 10:38 pm, marius d. marius.dan...@gmail.com wrote: No you can't override it because SHtml is an object not a type. The function definition above (def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) ) already exists in SHtml. In fact we have this deferring mechanism for other functions like ajaxButton, a, etc. If you're still having trouble using this please let me know and I'll make and example app. for you. Br's, Marius On Aug 19, 5:42 am, g-man gregor...@gmail.com wrote: OK, seems like I have to learn a little more about Scala so I can override the ajaxText method, right? Here it is in the docs: def ajaxText(value: String, func: String = JsCmd): Elem = ajaxText_* (value, SFuncHolder(func)) When I fumble around, it won't compile, because I'm just not doing it right. My project is a hobby, not mission-critical, so I'm under no pressure. For now, I will change to an ajaxForm, but the learning is all good, and if you want to keep teaching, I will listen! Thanks for your patience... On Aug 18, 12:41 pm, marius d. marius.dan...@gmail.com wrote: Having def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) jsFunc parameter is a Call which is defined as: case class Call(function: String, params: JsExp*) extends JsExp So by this you represent a javascript function invocations. So assuming somewhere you have a javascript function like: function myFunc(myParam, callback) { // do some logic callback() } in the snippet we have something like: ajaxText(task.dueOn.toString, Call(myFunc, Str(some_param_value)) v = { task.dueOn(v.toLong).save; reDrawTasks();}) As you can see we called Call(myFunc, Str (some_param_value)) .. .we provided the JS function name and one parameter. Lift will add the second parameter which is the callback function. This callback function represents the actual ajax call and since it is a callback you can invoke it whenever you want inside 'myFunc' javascript function. In other words you can defer the actual ajax call as you see fit. Now myFunc function declaration can be: 1. In your own .js file 2. Written in the script tag inside your html 3. Generate using Lifts' JS absctrations using JsCmds.Function() object such as: JsCmds.Function(MyFunc, List(myParam, callback),
[Lift] Re: slow down ajax?
No you can't override it because SHtml is an object not a type. The function definition above (def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) ) already exists in SHtml. In fact we have this deferring mechanism for other functions like ajaxButton, a, etc. If you're still having trouble using this please let me know and I'll make and example app. for you. Br's, Marius On Aug 19, 5:42 am, g-man gregor...@gmail.com wrote: OK, seems like I have to learn a little more about Scala so I can override the ajaxText method, right? Here it is in the docs: def ajaxText(value: String, func: String = JsCmd): Elem = ajaxText_* (value, SFuncHolder(func)) When I fumble around, it won't compile, because I'm just not doing it right. My project is a hobby, not mission-critical, so I'm under no pressure. For now, I will change to an ajaxForm, but the learning is all good, and if you want to keep teaching, I will listen! Thanks for your patience... On Aug 18, 12:41 pm, marius d. marius.dan...@gmail.com wrote: Having def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) jsFunc parameter is a Call which is defined as: case class Call(function: String, params: JsExp*) extends JsExp So by this you represent a javascript function invocations. So assuming somewhere you have a javascript function like: function myFunc(myParam, callback) { // do some logic callback() } in the snippet we have something like: ajaxText(task.dueOn.toString, Call(myFunc, Str(some_param_value)) v = { task.dueOn(v.toLong).save; reDrawTasks();}) As you can see we called Call(myFunc, Str (some_param_value)) .. .we provided the JS function name and one parameter. Lift will add the second parameter which is the callback function. This callback function represents the actual ajax call and since it is a callback you can invoke it whenever you want inside 'myFunc' javascript function. In other words you can defer the actual ajax call as you see fit. Now myFunc function declaration can be: 1. In your own .js file 2. Written in the script tag inside your html 3. Generate using Lifts' JS absctrations using JsCmds.Function() object such as: JsCmds.Function(MyFunc, List(myParam, callback), a_JsCmd_expression_which_is_the_function_body) The main point in all this is that you can defer the actual ajax call. You know better if this fits your case. Br's, Marius On Aug 18, 10:21 pm, g-man gregor...@gmail.com wrote: No, this is the old way ...I am unsure how to invoke the ajax method -- could you enlighten me? On Aug 17, 12:26 pm, marius d. marius.dan...@gmail.com wrote: I don't see in your code the use of the overloaded ajaxText that I posted. Have you tried it? Marius On Aug 17, 10:20 pm, g-man gregor...@gmail.com wrote: OK, thanks for checking back... Snippet: swappable(span class='dueon'{task.dueOn.toString}/span, span class='chgDueon'{ajaxText(task.dueOn.toString, v = { task.dueOn(v.toLong).save; reDrawTasks(); }) % (size - 10)}/span) JS: $chgDueon // jQuery selection for text field .datepicker({dateFormat:'m-d-yy', minDate: +1}) .blur(function(){$chgDueon.val(parseDate($chgDueon.val()));}); // works well to pick a new date and change it to millis for save Emitted XHTML: span span class=dueon id=F111290299287IBE onclick=jQuery('#'+'F111290299287IBE').hide(); jQuery('#'+'F1112902992880KN').show().each(function(i) { var t = this; setTimeout(function() { t.focus(); }, 200);});return false;; 1248493271843/span span style=display: none id=F1112902992880KN onblur=jQuery('#'+'F111290299287IBE').show(); jQuery('#'+'F1112902992880KN').hide(); input onblur=lift_ajaxHandler('F111290299286DL1=' + encodeURIComponent(this.value), null, null) type=text value=1248493271843 onkeypress=lift_blurIfReturn(event) size=10 / /span /span So, all the parts work well together, but Lift's ajax just takes off too quickly, and cannot read the new value. On Aug 16, 11:02 pm, marius d. marius.dan...@gmail.com wrote: You can probably use this definition of ajaxText: def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) See the jsFunc parameter. Essentially you are specifying your function call that may have one parameter. To your parameter list List we'll add a new parameter which is the ajax invocation function. In other words your code gets that function that does the ajax call meaning that you have the control over when the ajax call is made. Br's, Marius On Aug 17, 8:55 am, marius d. marius.dan...@gmail.com wrote:
[Lift] Re: slow down ajax?
I quoted the def from net.liftweb.http.SHtml in: http://scala-tools.org/scaladocs/liftweb/1.0/ and when I tried the other version, my complier did not accept the extra param. That's why I thought I had to override something... Is there a newer version I should be using? On Aug 18, 10:38 pm, marius d. marius.dan...@gmail.com wrote: No you can't override it because SHtml is an object not a type. The function definition above (def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) ) already exists in SHtml. In fact we have this deferring mechanism for other functions like ajaxButton, a, etc. If you're still having trouble using this please let me know and I'll make and example app. for you. Br's, Marius On Aug 19, 5:42 am, g-man gregor...@gmail.com wrote: OK, seems like I have to learn a little more about Scala so I can override the ajaxText method, right? Here it is in the docs: def ajaxText(value: String, func: String = JsCmd): Elem = ajaxText_* (value, SFuncHolder(func)) When I fumble around, it won't compile, because I'm just not doing it right. My project is a hobby, not mission-critical, so I'm under no pressure. For now, I will change to an ajaxForm, but the learning is all good, and if you want to keep teaching, I will listen! Thanks for your patience... On Aug 18, 12:41 pm, marius d. marius.dan...@gmail.com wrote: Having def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) jsFunc parameter is a Call which is defined as: case class Call(function: String, params: JsExp*) extends JsExp So by this you represent a javascript function invocations. So assuming somewhere you have a javascript function like: function myFunc(myParam, callback) { // do some logic callback() } in the snippet we have something like: ajaxText(task.dueOn.toString, Call(myFunc, Str(some_param_value)) v = { task.dueOn(v.toLong).save; reDrawTasks();}) As you can see we called Call(myFunc, Str (some_param_value)) .. .we provided the JS function name and one parameter. Lift will add the second parameter which is the callback function. This callback function represents the actual ajax call and since it is a callback you can invoke it whenever you want inside 'myFunc' javascript function. In other words you can defer the actual ajax call as you see fit. Now myFunc function declaration can be: 1. In your own .js file 2. Written in the script tag inside your html 3. Generate using Lifts' JS absctrations using JsCmds.Function() object such as: JsCmds.Function(MyFunc, List(myParam, callback), a_JsCmd_expression_which_is_the_function_body) The main point in all this is that you can defer the actual ajax call. You know better if this fits your case. Br's, Marius On Aug 18, 10:21 pm, g-man gregor...@gmail.com wrote: No, this is the old way ...I am unsure how to invoke the ajax method -- could you enlighten me? On Aug 17, 12:26 pm, marius d. marius.dan...@gmail.com wrote: I don't see in your code the use of the overloaded ajaxText that I posted. Have you tried it? Marius On Aug 17, 10:20 pm, g-man gregor...@gmail.com wrote: OK, thanks for checking back... Snippet: swappable(span class='dueon'{task.dueOn.toString}/span, span class='chgDueon'{ajaxText(task.dueOn.toString, v = { task.dueOn(v.toLong).save; reDrawTasks(); }) % (size - 10)}/span) JS: $chgDueon // jQuery selection for text field .datepicker({dateFormat:'m-d-yy', minDate: +1}) .blur(function(){$chgDueon.val(parseDate($chgDueon.val()));}); // works well to pick a new date and change it to millis for save Emitted XHTML: span span class=dueon id=F111290299287IBE onclick=jQuery('#'+'F111290299287IBE').hide(); jQuery('#'+'F1112902992880KN').show().each(function(i) { var t = this; setTimeout(function() { t.focus(); }, 200);});return false;; 1248493271843/span span style=display: none id=F1112902992880KN onblur=jQuery('#'+'F111290299287IBE').show(); jQuery('#'+'F1112902992880KN').hide(); input onblur=lift_ajaxHandler('F111290299286DL1=' + encodeURIComponent(this.value), null, null) type=text value=1248493271843 onkeypress=lift_blurIfReturn(event) size=10 / /span /span So, all the parts work well together, but Lift's ajax just takes off too quickly, and cannot read the new value. On Aug 16, 11:02 pm, marius d. marius.dan...@gmail.com wrote: You can probably use this definition of ajaxText: def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) See the jsFunc
[Lift] Re: slow down ajax?
Well, I went down the rabbit hole on a quest for 1.1-SNAPSHOT - It is not visible, even though my pom points to it, and the .m2 repository shows a directory for it. .m2\repository\net\liftweb\lift-archetype-basic\1.1-SNAPSHOT Bottom line is : src\main\scala\bootstrap\liftweb\Boot.scala:11: error: value provider is not a member of package net.liftweb.http import http.provider._ and: error: wrong number of arguments for method ajaxText: (String,(String) = net.liftweb.http.js.JsCmd)scala.xml.Elem So Lift can't see the new stuff, and I also can't get an archetype created using the 1.1-SNAPSHOT, so I will keep hacking unless you have some further guidance for me. On Aug 19, 12:20 pm, marius d. marius.dan...@gmail.com wrote: Please use Lift 1.1-SNAPSHOT Br's, Marius On Aug 19, 10:06 pm, g-man gregor...@gmail.com wrote: I quoted the def from net.liftweb.http.SHtml in: http://scala-tools.org/scaladocs/liftweb/1.0/ and when I tried the other version, my complier did not accept the extra param. That's why I thought I had to override something... Is there a newer version I should be using? On Aug 18, 10:38 pm, marius d. marius.dan...@gmail.com wrote: No you can't override it because SHtml is an object not a type. The function definition above (def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) ) already exists in SHtml. In fact we have this deferring mechanism for other functions like ajaxButton, a, etc. If you're still having trouble using this please let me know and I'll make and example app. for you. Br's, Marius On Aug 19, 5:42 am, g-man gregor...@gmail.com wrote: OK, seems like I have to learn a little more about Scala so I can override the ajaxText method, right? Here it is in the docs: def ajaxText(value: String, func: String = JsCmd): Elem = ajaxText_* (value, SFuncHolder(func)) When I fumble around, it won't compile, because I'm just not doing it right. My project is a hobby, not mission-critical, so I'm under no pressure. For now, I will change to an ajaxForm, but the learning is all good, and if you want to keep teaching, I will listen! Thanks for your patience... On Aug 18, 12:41 pm, marius d. marius.dan...@gmail.com wrote: Having def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) jsFunc parameter is a Call which is defined as: case class Call(function: String, params: JsExp*) extends JsExp So by this you represent a javascript function invocations. So assuming somewhere you have a javascript function like: function myFunc(myParam, callback) { // do some logic callback() } in the snippet we have something like: ajaxText(task.dueOn.toString, Call(myFunc, Str(some_param_value)) v = { task.dueOn(v.toLong).save; reDrawTasks();}) As you can see we called Call(myFunc, Str (some_param_value)) .. .we provided the JS function name and one parameter. Lift will add the second parameter which is the callback function. This callback function represents the actual ajax call and since it is a callback you can invoke it whenever you want inside 'myFunc' javascript function. In other words you can defer the actual ajax call as you see fit. Now myFunc function declaration can be: 1. In your own .js file 2. Written in the script tag inside your html 3. Generate using Lifts' JS absctrations using JsCmds.Function() object such as: JsCmds.Function(MyFunc, List(myParam, callback), a_JsCmd_expression_which_is_the_function_body) The main point in all this is that you can defer the actual ajax call. You know better if this fits your case. Br's, Marius On Aug 18, 10:21 pm, g-man gregor...@gmail.com wrote: No, this is the old way ...I am unsure how to invoke the ajax method -- could you enlighten me? On Aug 17, 12:26 pm, marius d. marius.dan...@gmail.com wrote: I don't see in your code the use of the overloaded ajaxText that I posted. Have you tried it? Marius On Aug 17, 10:20 pm, g-man gregor...@gmail.com wrote: OK, thanks for checking back... Snippet: swappable(span class='dueon'{task.dueOn.toString}/span, span class='chgDueon'{ajaxText(task.dueOn.toString, v = { task.dueOn(v.toLong).save; reDrawTasks(); }) % (size - 10)}/span) JS: $chgDueon // jQuery selection for text field .datepicker({dateFormat:'m-d-yy', minDate: +1}) .blur(function(){$chgDueon.val(parseDate($chgDueon.val()));}); // works well to pick a new date and change it to millis for save Emitted XHTML: span span class=dueon id=F111290299287IBE
[Lift] Re: slow down ajax?
Are you using maven to compile? Delete any earlier jar so you rule out that possibility. Also, if you turn on debug output in maven (-X) it might tell you the path that it's using to invoke the compiler so you can see which jar it's using if any. - g-mangregor...@gmail.com wrote: Well, I went down the rabbit hole on a quest for 1.1-SNAPSHOT - It is not visible, even though my pom points to it, and the .m2 repository shows a directory for it. .m2\repository\net\liftweb\lift-archetype-basic\1.1-SNAPSHOT Bottom line is : src\main\scala\bootstrap\liftweb\Boot.scala:11: error: value provider is not a member of package net.liftweb.http import http.provider._ and: error: wrong number of arguments for method ajaxText: (String,(String) = net.liftweb.http.js.JsCmd)scala.xml.Elem So Lift can't see the new stuff, and I also can't get an archetype created using the 1.1-SNAPSHOT, so I will keep hacking unless you have some further guidance for me. On Aug 19, 12:20 pm, marius d. marius.dan...@gmail.com wrote: Please use Lift 1.1-SNAPSHOT Br's, Marius On Aug 19, 10:06 pm, g-man gregor...@gmail.com wrote: I quoted the def from net.liftweb.http.SHtml in: http://scala-tools.org/scaladocs/liftweb/1.0/ and when I tried the other version, my complier did not accept the extra param. That's why I thought I had to override something... Is there a newer version I should be using? On Aug 18, 10:38 pm, marius d. marius.dan...@gmail.com wrote: No you can't override it because SHtml is an object not a type. The function definition above (def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) ) already exists in SHtml. In fact we have this deferring mechanism for other functions like ajaxButton, a, etc. If you're still having trouble using this please let me know and I'll make and example app. for you. Br's, Marius On Aug 19, 5:42 am, g-man gregor...@gmail.com wrote: OK, seems like I have to learn a little more about Scala so I can override the ajaxText method, right? Here it is in the docs: def ajaxText(value: String, func: String = JsCmd): Elem = ajaxText_* (value, SFuncHolder(func)) When I fumble around, it won't compile, because I'm just not doing it right. My project is a hobby, not mission-critical, so I'm under no pressure. For now, I will change to an ajaxForm, but the learning is all good, and if you want to keep teaching, I will listen! Thanks for your patience... On Aug 18, 12:41 pm, marius d. marius.dan...@gmail.com wrote: Having def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) jsFunc parameter is a Call which is defined as: case class Call(function: String, params: JsExp*) extends JsExp So by this you represent a javascript function invocations. So assuming somewhere you have a javascript function like: function myFunc(myParam, callback) { // do some logic callback() } in the snippet we have something like: ajaxText(task.dueOn.toString, Call(myFunc, Str(some_param_value)) v = { task.dueOn(v.toLong).save; reDrawTasks();}) As you can see we called Call(myFunc, Str (some_param_value)) .. .we provided the JS function name and one parameter. Lift will add the second parameter which is the callback function. This callback function represents the actual ajax call and since it is a callback you can invoke it whenever you want inside 'myFunc' javascript function. In other words you can defer the actual ajax call as you see fit. Now myFunc function declaration can be: 1. In your own .js file 2. Written in the script tag inside your html 3. Generate using Lifts' JS absctrations using JsCmds.Function() object such as: JsCmds.Function(MyFunc, List(myParam, callback), a_JsCmd_expression_which_is_the_function_body) The main point in all this is that you can defer the actual ajax call. You know better if this fits your case. Br's, Marius On Aug 18, 10:21 pm, g-man gregor...@gmail.com wrote: No, this is the old way ...I am unsure how to invoke the ajax method -- could you enlighten me? On Aug 17, 12:26 pm, marius d. marius.dan...@gmail.com wrote: I don't see in your code the use of the overloaded ajaxText that I posted. Have you tried it? Marius On Aug 17, 10:20 pm, g-man gregor...@gmail.com wrote: OK, thanks for checking back... Snippet: swappable(span class='dueon'{task.dueOn.toString}/span, span class='chgDueon'{ajaxText(task.dueOn.toString, v = { task.dueOn(v.toLong).save; reDrawTasks(); }) % (size - 10)}/span) JS: $chgDueon // jQuery selection for text
[Lift] Re: slow down ajax?
Or just checkout from git master and do a mvn clean:clean install Trust me it's all there :) Br's, Marius On Aug 20, 8:15 am, Naftoli Gugenheim naftoli...@gmail.com wrote: Are you using maven to compile? Delete any earlier jar so you rule out that possibility. Also, if you turn on debug output in maven (-X) it might tell you the path that it's using to invoke the compiler so you can see which jar it's using if any. - g-mangregor...@gmail.com wrote: Well, I went down the rabbit hole on a quest for 1.1-SNAPSHOT - It is not visible, even though my pom points to it, and the .m2 repository shows a directory for it. .m2\repository\net\liftweb\lift-archetype-basic\1.1-SNAPSHOT Bottom line is : src\main\scala\bootstrap\liftweb\Boot.scala:11: error: value provider is not a member of package net.liftweb.http import http.provider._ and: error: wrong number of arguments for method ajaxText: (String,(String) = net.liftweb.http.js.JsCmd)scala.xml.Elem So Lift can't see the new stuff, and I also can't get an archetype created using the 1.1-SNAPSHOT, so I will keep hacking unless you have some further guidance for me. On Aug 19, 12:20 pm, marius d. marius.dan...@gmail.com wrote: Please use Lift 1.1-SNAPSHOT Br's, Marius On Aug 19, 10:06 pm, g-man gregor...@gmail.com wrote: I quoted the def from net.liftweb.http.SHtml in: http://scala-tools.org/scaladocs/liftweb/1.0/ and when I tried the other version, my complier did not accept the extra param. That's why I thought I had to override something... Is there a newer version I should be using? On Aug 18, 10:38 pm, marius d. marius.dan...@gmail.com wrote: No you can't override it because SHtml is an object not a type. The function definition above (def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) ) already exists in SHtml. In fact we have this deferring mechanism for other functions like ajaxButton, a, etc. If you're still having trouble using this please let me know and I'll make and example app. for you. Br's, Marius On Aug 19, 5:42 am, g-man gregor...@gmail.com wrote: OK, seems like I have to learn a little more about Scala so I can override the ajaxText method, right? Here it is in the docs: def ajaxText(value: String, func: String = JsCmd): Elem = ajaxText_* (value, SFuncHolder(func)) When I fumble around, it won't compile, because I'm just not doing it right. My project is a hobby, not mission-critical, so I'm under no pressure. For now, I will change to an ajaxForm, but the learning is all good, and if you want to keep teaching, I will listen! Thanks for your patience... On Aug 18, 12:41 pm, marius d. marius.dan...@gmail.com wrote: Having def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) jsFunc parameter is a Call which is defined as: case class Call(function: String, params: JsExp*) extends JsExp So by this you represent a javascript function invocations. So assuming somewhere you have a javascript function like: function myFunc(myParam, callback) { // do some logic callback() } in the snippet we have something like: ajaxText(task.dueOn.toString, Call(myFunc, Str(some_param_value)) v = { task.dueOn(v.toLong).save; reDrawTasks();}) As you can see we called Call(myFunc, Str (some_param_value)) .. .we provided the JS function name and one parameter. Lift will add the second parameter which is the callback function. This callback function represents the actual ajax call and since it is a callback you can invoke it whenever you want inside 'myFunc' javascript function. In other words you can defer the actual ajax call as you see fit. Now myFunc function declaration can be: 1. In your own .js file 2. Written in the script tag inside your html 3. Generate using Lifts' JS absctrations using JsCmds.Function() object such as: JsCmds.Function(MyFunc, List(myParam, callback), a_JsCmd_expression_which_is_the_function_body) The main point in all this is that you can defer the actual ajax call. You know better if this fits your case. Br's, Marius On Aug 18, 10:21 pm, g-man gregor...@gmail.com wrote: No, this is the old way ...I am unsure how to invoke the ajax method -- could you enlighten me? On Aug 17, 12:26 pm, marius d. marius.dan...@gmail.com wrote: I don't see in your code the use of the overloaded ajaxText that I posted. Have you tried it? Marius On Aug 17, 10:20 pm, g-man gregor...@gmail.com wrote: OK, thanks for checking back... Snippet: swappable(span
[Lift] Re: slow down ajax?
No, this is the old way ...I am unsure how to invoke the ajax method -- could you enlighten me? On Aug 17, 12:26 pm, marius d. marius.dan...@gmail.com wrote: I don't see in your code the use of the overloaded ajaxText that I posted. Have you tried it? Marius On Aug 17, 10:20 pm, g-man gregor...@gmail.com wrote: OK, thanks for checking back... Snippet: swappable(span class='dueon'{task.dueOn.toString}/span, span class='chgDueon'{ajaxText(task.dueOn.toString, v = { task.dueOn(v.toLong).save; reDrawTasks(); }) % (size - 10)}/span) JS: $chgDueon // jQuery selection for text field .datepicker({dateFormat:'m-d-yy', minDate: +1}) .blur(function(){$chgDueon.val(parseDate($chgDueon.val()));}); // works well to pick a new date and change it to millis for save Emitted XHTML: span span class=dueon id=F111290299287IBE onclick=jQuery('#'+'F111290299287IBE').hide(); jQuery('#'+'F1112902992880KN').show().each(function(i) { var t = this; setTimeout(function() { t.focus(); }, 200);});return false;; 1248493271843/span span style=display: none id=F1112902992880KN onblur=jQuery('#'+'F111290299287IBE').show(); jQuery('#'+'F1112902992880KN').hide(); input onblur=lift_ajaxHandler('F111290299286DL1=' + encodeURIComponent(this.value), null, null) type=text value=1248493271843 onkeypress=lift_blurIfReturn(event) size=10 / /span /span So, all the parts work well together, but Lift's ajax just takes off too quickly, and cannot read the new value. On Aug 16, 11:02 pm, marius d. marius.dan...@gmail.com wrote: You can probably use this definition of ajaxText: def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) See the jsFunc parameter. Essentially you are specifying your function call that may have one parameter. To your parameter list List we'll add a new parameter which is the ajax invocation function. In other words your code gets that function that does the ajax call meaning that you have the control over when the ajax call is made. Br's, Marius On Aug 17, 8:55 am, marius d. marius.dan...@gmail.com wrote: Would you please post a code snippet with what you're doing? (a minimalistic example) Br's, Marius On Aug 17, 7:41 am, g-man gregor...@gmail.com wrote: I am moving nicely with my 'save all dates as millis and let the client localize for display' project, learning while enhancing the ToDo sample app. I have added a 'dueOn' field, and that is displayed as swappable ajaxText, similar to the other fields in the tutorial. I have enabled datepicker for the ajaxText field via jQuery, and have a parsing function attached an event listener, so when datepicker finishes, the date is converted to millis, ready for Lift to send back to the server and save. So far, all good. The problem is that Lift's ajax starts ('onblur') before it has a chance to see the new date value, so the new value is never saved. What I need is a way to tell Lift to wait until after my parser has had a chance to write the changed value. I like the ajax style, so I don't want to make a 'submit' form, and 'onchange' won't do it either, because the value is actually changed twice (once to a formatted date, once to millis). What I need is some way to say, 'OK to start ajax now'! --~--~-~--~~~---~--~~ 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: slow down ajax?
Having def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) jsFunc parameter is a Call which is defined as: case class Call(function: String, params: JsExp*) extends JsExp So by this you represent a javascript function invocations. So assuming somewhere you have a javascript function like: function myFunc(myParam, callback) { // do some logic callback() } in the snippet we have something like: ajaxText(task.dueOn.toString, Call(myFunc, Str(some_param_value)) v = { task.dueOn(v.toLong).save; reDrawTasks();}) As you can see we called Call(myFunc, Str (some_param_value)) .. .we provided the JS function name and one parameter. Lift will add the second parameter which is the callback function. This callback function represents the actual ajax call and since it is a callback you can invoke it whenever you want inside 'myFunc' javascript function. In other words you can defer the actual ajax call as you see fit. Now myFunc function declaration can be: 1. In your own .js file 2. Written in the script tag inside your html 3. Generate using Lifts' JS absctrations using JsCmds.Function() object such as: JsCmds.Function(MyFunc, List(myParam, callback), a_JsCmd_expression_which_is_the_function_body) The main point in all this is that you can defer the actual ajax call. You know better if this fits your case. Br's, Marius On Aug 18, 10:21 pm, g-man gregor...@gmail.com wrote: No, this is the old way ...I am unsure how to invoke the ajax method -- could you enlighten me? On Aug 17, 12:26 pm, marius d. marius.dan...@gmail.com wrote: I don't see in your code the use of the overloaded ajaxText that I posted. Have you tried it? Marius On Aug 17, 10:20 pm, g-man gregor...@gmail.com wrote: OK, thanks for checking back... Snippet: swappable(span class='dueon'{task.dueOn.toString}/span, span class='chgDueon'{ajaxText(task.dueOn.toString, v = { task.dueOn(v.toLong).save; reDrawTasks(); }) % (size - 10)}/span) JS: $chgDueon // jQuery selection for text field .datepicker({dateFormat:'m-d-yy', minDate: +1}) .blur(function(){$chgDueon.val(parseDate($chgDueon.val()));}); // works well to pick a new date and change it to millis for save Emitted XHTML: span span class=dueon id=F111290299287IBE onclick=jQuery('#'+'F111290299287IBE').hide(); jQuery('#'+'F1112902992880KN').show().each(function(i) { var t = this; setTimeout(function() { t.focus(); }, 200);});return false;; 1248493271843/span span style=display: none id=F1112902992880KN onblur=jQuery('#'+'F111290299287IBE').show(); jQuery('#'+'F1112902992880KN').hide(); input onblur=lift_ajaxHandler('F111290299286DL1=' + encodeURIComponent(this.value), null, null) type=text value=1248493271843 onkeypress=lift_blurIfReturn(event) size=10 / /span /span So, all the parts work well together, but Lift's ajax just takes off too quickly, and cannot read the new value. On Aug 16, 11:02 pm, marius d. marius.dan...@gmail.com wrote: You can probably use this definition of ajaxText: def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) See the jsFunc parameter. Essentially you are specifying your function call that may have one parameter. To your parameter list List we'll add a new parameter which is the ajax invocation function. In other words your code gets that function that does the ajax call meaning that you have the control over when the ajax call is made. Br's, Marius On Aug 17, 8:55 am, marius d. marius.dan...@gmail.com wrote: Would you please post a code snippet with what you're doing? (a minimalistic example) Br's, Marius On Aug 17, 7:41 am, g-man gregor...@gmail.com wrote: I am moving nicely with my 'save all dates as millis and let the client localize for display' project, learning while enhancing the ToDo sample app. I have added a 'dueOn' field, and that is displayed as swappable ajaxText, similar to the other fields in the tutorial. I have enabled datepicker for the ajaxText field via jQuery, and have a parsing function attached an event listener, so when datepicker finishes, the date is converted to millis, ready for Lift to send back to the server and save. So far, all good. The problem is that Lift's ajax starts ('onblur') before it has a chance to see the new date value, so the new value is never saved. What I need is a way to tell Lift to wait until after my parser has had a chance to write the changed value. I like the ajax style, so I don't want to make a 'submit' form, and 'onchange' won't do it either, because the value is actually changed twice
[Lift] Re: slow down ajax?
OK, seems like I have to learn a little more about Scala so I can override the ajaxText method, right? Here it is in the docs: def ajaxText(value: String, func: String = JsCmd): Elem = ajaxText_* (value, SFuncHolder(func)) When I fumble around, it won't compile, because I'm just not doing it right. My project is a hobby, not mission-critical, so I'm under no pressure. For now, I will change to an ajaxForm, but the learning is all good, and if you want to keep teaching, I will listen! Thanks for your patience... On Aug 18, 12:41 pm, marius d. marius.dan...@gmail.com wrote: Having def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) jsFunc parameter is a Call which is defined as: case class Call(function: String, params: JsExp*) extends JsExp So by this you represent a javascript function invocations. So assuming somewhere you have a javascript function like: function myFunc(myParam, callback) { // do some logic callback() } in the snippet we have something like: ajaxText(task.dueOn.toString, Call(myFunc, Str(some_param_value)) v = { task.dueOn(v.toLong).save; reDrawTasks();}) As you can see we called Call(myFunc, Str (some_param_value)) .. .we provided the JS function name and one parameter. Lift will add the second parameter which is the callback function. This callback function represents the actual ajax call and since it is a callback you can invoke it whenever you want inside 'myFunc' javascript function. In other words you can defer the actual ajax call as you see fit. Now myFunc function declaration can be: 1. In your own .js file 2. Written in the script tag inside your html 3. Generate using Lifts' JS absctrations using JsCmds.Function() object such as: JsCmds.Function(MyFunc, List(myParam, callback), a_JsCmd_expression_which_is_the_function_body) The main point in all this is that you can defer the actual ajax call. You know better if this fits your case. Br's, Marius On Aug 18, 10:21 pm, g-man gregor...@gmail.com wrote: No, this is the old way ...I am unsure how to invoke the ajax method -- could you enlighten me? On Aug 17, 12:26 pm, marius d. marius.dan...@gmail.com wrote: I don't see in your code the use of the overloaded ajaxText that I posted. Have you tried it? Marius On Aug 17, 10:20 pm, g-man gregor...@gmail.com wrote: OK, thanks for checking back... Snippet: swappable(span class='dueon'{task.dueOn.toString}/span, span class='chgDueon'{ajaxText(task.dueOn.toString, v = { task.dueOn(v.toLong).save; reDrawTasks(); }) % (size - 10)}/span) JS: $chgDueon // jQuery selection for text field .datepicker({dateFormat:'m-d-yy', minDate: +1}) .blur(function(){$chgDueon.val(parseDate($chgDueon.val()));}); // works well to pick a new date and change it to millis for save Emitted XHTML: span span class=dueon id=F111290299287IBE onclick=jQuery('#'+'F111290299287IBE').hide(); jQuery('#'+'F1112902992880KN').show().each(function(i) { var t = this; setTimeout(function() { t.focus(); }, 200);});return false;; 1248493271843/span span style=display: none id=F1112902992880KN onblur=jQuery('#'+'F111290299287IBE').show(); jQuery('#'+'F1112902992880KN').hide(); input onblur=lift_ajaxHandler('F111290299286DL1=' + encodeURIComponent(this.value), null, null) type=text value=1248493271843 onkeypress=lift_blurIfReturn(event) size=10 / /span /span So, all the parts work well together, but Lift's ajax just takes off too quickly, and cannot read the new value. On Aug 16, 11:02 pm, marius d. marius.dan...@gmail.com wrote: You can probably use this definition of ajaxText: def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) See the jsFunc parameter. Essentially you are specifying your function call that may have one parameter. To your parameter list List we'll add a new parameter which is the ajax invocation function. In other words your code gets that function that does the ajax call meaning that you have the control over when the ajax call is made. Br's, Marius On Aug 17, 8:55 am, marius d. marius.dan...@gmail.com wrote: Would you please post a code snippet with what you're doing? (a minimalistic example) Br's, Marius On Aug 17, 7:41 am, g-man gregor...@gmail.com wrote: I am moving nicely with my 'save all dates as millis and let the client localize for display' project, learning while enhancing the ToDo sample app. I have added a 'dueOn' field, and that is displayed as swappable ajaxText, similar to the other fields in the tutorial. I have enabled datepicker for the ajaxText
[Lift] Re: slow down ajax?
You can probably use this definition of ajaxText: def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) See the jsFunc parameter. Essentially you are specifying your function call that may have one parameter. To your parameter list List we'll add a new parameter which is the ajax invocation function. In other words your code gets that function that does the ajax call meaning that you have the control over when the ajax call is made. Br's, Marius On Aug 17, 8:55 am, marius d. marius.dan...@gmail.com wrote: Would you please post a code snippet with what you're doing? (a minimalistic example) Br's, Marius On Aug 17, 7:41 am, g-man gregor...@gmail.com wrote: I am moving nicely with my 'save all dates as millis and let the client localize for display' project, learning while enhancing the ToDo sample app. I have added a 'dueOn' field, and that is displayed as swappable ajaxText, similar to the other fields in the tutorial. I have enabled datepicker for the ajaxText field via jQuery, and have a parsing function attached an event listener, so when datepicker finishes, the date is converted to millis, ready for Lift to send back to the server and save. So far, all good. The problem is that Lift's ajax starts ('onblur') before it has a chance to see the new date value, so the new value is never saved. What I need is a way to tell Lift to wait until after my parser has had a chance to write the changed value. I like the ajax style, so I don't want to make a 'submit' form, and 'onchange' won't do it either, because the value is actually changed twice (once to a formatted date, once to millis). What I need is some way to say, 'OK to start ajax now'! --~--~-~--~~~---~--~~ 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: slow down ajax?
OK, thanks for checking back... Snippet: swappable(span class='dueon'{task.dueOn.toString}/span, span class='chgDueon'{ajaxText(task.dueOn.toString, v = { task.dueOn(v.toLong).save; reDrawTasks(); }) % (size - 10)}/span) JS: $chgDueon // jQuery selection for text field .datepicker({dateFormat:'m-d-yy', minDate: +1}) .blur(function(){$chgDueon.val(parseDate($chgDueon.val()));}); // works well to pick a new date and change it to millis for save Emitted XHTML: span span class=dueon id=F111290299287IBE onclick=jQuery('#'+'F111290299287IBE').hide(); jQuery('#'+'F1112902992880KN').show().each(function(i) { var t = this; setTimeout(function() { t.focus(); }, 200);});return false;; 1248493271843/span span style=display: none id=F1112902992880KN onblur=jQuery('#'+'F111290299287IBE').show(); jQuery('#'+'F1112902992880KN').hide(); input onblur=lift_ajaxHandler('F111290299286DL1=' + encodeURIComponent(this.value), null, null) type=text value=1248493271843 onkeypress=lift_blurIfReturn(event) size=10 / /span /span So, all the parts work well together, but Lift's ajax just takes off too quickly, and cannot read the new value. On Aug 16, 11:02 pm, marius d. marius.dan...@gmail.com wrote: You can probably use this definition of ajaxText: def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) See the jsFunc parameter. Essentially you are specifying your function call that may have one parameter. To your parameter list List we'll add a new parameter which is the ajax invocation function. In other words your code gets that function that does the ajax call meaning that you have the control over when the ajax call is made. Br's, Marius On Aug 17, 8:55 am, marius d. marius.dan...@gmail.com wrote: Would you please post a code snippet with what you're doing? (a minimalistic example) Br's, Marius On Aug 17, 7:41 am, g-man gregor...@gmail.com wrote: I am moving nicely with my 'save all dates as millis and let the client localize for display' project, learning while enhancing the ToDo sample app. I have added a 'dueOn' field, and that is displayed as swappable ajaxText, similar to the other fields in the tutorial. I have enabled datepicker for the ajaxText field via jQuery, and have a parsing function attached an event listener, so when datepicker finishes, the date is converted to millis, ready for Lift to send back to the server and save. So far, all good. The problem is that Lift's ajax starts ('onblur') before it has a chance to see the new date value, so the new value is never saved. What I need is a way to tell Lift to wait until after my parser has had a chance to write the changed value. I like the ajax style, so I don't want to make a 'submit' form, and 'onchange' won't do it either, because the value is actually changed twice (once to a formatted date, once to millis). What I need is some way to say, 'OK to start ajax now'! --~--~-~--~~~---~--~~ 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: slow down ajax?
I don't see in your code the use of the overloaded ajaxText that I posted. Have you tried it? Marius On Aug 17, 10:20 pm, g-man gregor...@gmail.com wrote: OK, thanks for checking back... Snippet: swappable(span class='dueon'{task.dueOn.toString}/span, span class='chgDueon'{ajaxText(task.dueOn.toString, v = { task.dueOn(v.toLong).save; reDrawTasks(); }) % (size - 10)}/span) JS: $chgDueon // jQuery selection for text field .datepicker({dateFormat:'m-d-yy', minDate: +1}) .blur(function(){$chgDueon.val(parseDate($chgDueon.val()));}); // works well to pick a new date and change it to millis for save Emitted XHTML: span span class=dueon id=F111290299287IBE onclick=jQuery('#'+'F111290299287IBE').hide(); jQuery('#'+'F1112902992880KN').show().each(function(i) { var t = this; setTimeout(function() { t.focus(); }, 200);});return false;; 1248493271843/span span style=display: none id=F1112902992880KN onblur=jQuery('#'+'F111290299287IBE').show(); jQuery('#'+'F1112902992880KN').hide(); input onblur=lift_ajaxHandler('F111290299286DL1=' + encodeURIComponent(this.value), null, null) type=text value=1248493271843 onkeypress=lift_blurIfReturn(event) size=10 / /span /span So, all the parts work well together, but Lift's ajax just takes off too quickly, and cannot read the new value. On Aug 16, 11:02 pm, marius d. marius.dan...@gmail.com wrote: You can probably use this definition of ajaxText: def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) See the jsFunc parameter. Essentially you are specifying your function call that may have one parameter. To your parameter list List we'll add a new parameter which is the ajax invocation function. In other words your code gets that function that does the ajax call meaning that you have the control over when the ajax call is made. Br's, Marius On Aug 17, 8:55 am, marius d. marius.dan...@gmail.com wrote: Would you please post a code snippet with what you're doing? (a minimalistic example) Br's, Marius On Aug 17, 7:41 am, g-man gregor...@gmail.com wrote: I am moving nicely with my 'save all dates as millis and let the client localize for display' project, learning while enhancing the ToDo sample app. I have added a 'dueOn' field, and that is displayed as swappable ajaxText, similar to the other fields in the tutorial. I have enabled datepicker for the ajaxText field via jQuery, and have a parsing function attached an event listener, so when datepicker finishes, the date is converted to millis, ready for Lift to send back to the server and save. So far, all good. The problem is that Lift's ajax starts ('onblur') before it has a chance to see the new date value, so the new value is never saved. What I need is a way to tell Lift to wait until after my parser has had a chance to write the changed value. I like the ajax style, so I don't want to make a 'submit' form, and 'onchange' won't do it either, because the value is actually changed twice (once to a formatted date, once to millis). What I need is some way to say, 'OK to start ajax now'! --~--~-~--~~~---~--~~ 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: slow down ajax?
Would you please post a code snippet with what you're doing? (a minimalistic example) Br's, Marius On Aug 17, 7:41 am, g-man gregor...@gmail.com wrote: I am moving nicely with my 'save all dates as millis and let the client localize for display' project, learning while enhancing the ToDo sample app. I have added a 'dueOn' field, and that is displayed as swappable ajaxText, similar to the other fields in the tutorial. I have enabled datepicker for the ajaxText field via jQuery, and have a parsing function attached an event listener, so when datepicker finishes, the date is converted to millis, ready for Lift to send back to the server and save. So far, all good. The problem is that Lift's ajax starts ('onblur') before it has a chance to see the new date value, so the new value is never saved. What I need is a way to tell Lift to wait until after my parser has had a chance to write the changed value. I like the ajax style, so I don't want to make a 'submit' form, and 'onchange' won't do it either, because the value is actually changed twice (once to a formatted date, once to millis). What I need is some way to say, 'OK to start ajax now'! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---