<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 29, 2014 at 10:39 PM, Esteban A. Maringolo <span dir="ltr">&lt;<a href="mailto:emaringolo@gmail.com" target="_blank">emaringolo@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I don&#39;t know for autocomplete, but a long time ago I implemented that like this:<br>
<br>
html document addLoadScript: (JSStream on:<br>
&#39;$(document).ajaxComplete(function() {$(&quot;#xhrstatus&quot;).hide();})&#39;).<br>
html document addLoadScript: (JSStream on:<br>
&#39;$(document).ajaxStart(function() {$(&quot;#xhrstatus&quot;).show();})&#39;).<br>
<br>
And it works well. I could refactor it, but because it works...<br>
</blockquote><div><br></div><div>WTF! that worked!! Thanks Esteban! This works for me:</div><div><br></div><div><div>renderAjaxLoadingDivOn: html</div><div><span class="" style="white-space:pre">        </span>html </div><div><span class="" style="white-space:pre">                </span>div </div><div><span class="" style="white-space:pre">                        </span>style: &#39;display:none&#39;;</div><div><span class="" style="white-space:pre">                        </span>id: &#39;loading&#39;;</div><div><span class="" style="white-space:pre">                        </span>class: &#39;loading&#39;;</div><div><span class="" style="white-space:pre">                        </span>with: &#39;Loading...&#39;.</div><div><span class="" style="white-space:pre">        </span>html document addLoadScript: (JSStream on:</div><div><span class="" style="white-space:pre">                </span>&#39;$(document).ajaxComplete(function() {$(&quot;#loading&quot;).hide();})&#39;).</div><div><span class="" style="white-space:pre">        </span>html document addLoadScript: (JSStream on:</div><div><span class="" style="white-space:pre">                </span>&#39;$(document).ajaxStart(function() {$(&quot;#loading&quot;).show();})&#39;).</div></div><div> </div><div><br></div><div><br></div><div>does anyone know what is the difference or why this one works while the other does not?</div><div><br></div><div>Thanks Esteban.</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Esteban A. Maringolo<br>
<br>
<br>
2014-10-29 22:35 GMT-03:00 Mariano Martinez Peck &lt;<a href="mailto:marianopeck@gmail.com">marianopeck@gmail.com</a>&gt;:<br>
<div class=""><div class="h5">&gt;<br>
&gt;<br>
&gt; On Wed, Oct 29, 2014 at 8:24 PM, Paul DeBruicker &lt;<a href="mailto:pdebruic@gmail.com">pdebruic@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; What jQuery version?<br>
&gt;&gt;<br>
&gt;&gt; It might be because the #onAjaxStart: and #onAjaxStop: methods should only<br>
&gt;&gt; be set on the document for some jQuerys (e.g. &gt;= version 1.8) see:<br>
&gt;&gt; <a href="http://api.jquery.com/ajaxStart/" target="_blank">http://api.jquery.com/ajaxStart/</a><br>
&gt;&gt;<br>
&gt;<br>
&gt; Thanks Paul. I am using 1.11.0. So if I understand what you mean, I guess I<br>
&gt; should do instead:<br>
&gt;<br>
&gt; html<br>
&gt; div<br>
&gt; style: &#39;display:none&#39;;<br>
&gt; class: &#39;quuveLoading&#39;;<br>
&gt; script: (html jQuery document<br>
&gt; onAjaxStart: (html jQuery this show);<br>
&gt; onAjaxStop: (html jQuery this hide));<br>
&gt; with: &#39;Loading...&#39;<br>
&gt;<br>
&gt;<br>
&gt; right? still not working thought :(<br>
&gt;<br>
&gt; I tried even a simple &#39;alert(&#39;&#39;aa&#39;&#39;);&#39; but still not getting called..<br>
&gt;<br>
&gt; Thanks anyway.<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Mariano Martinez Peck wrote<br>
&gt;&gt; &gt; Hi guys,<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; My app has a some code (thanks Esteban Lorenzano for sharing it with me)<br>
&gt;&gt; &gt; to<br>
&gt;&gt; &gt; show a little &quot;Loading...&quot; banner... That is:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; renderAjaxLoadingDivOn: html<br>
&gt;&gt; &gt; html<br>
&gt;&gt; &gt; div<br>
&gt;&gt; &gt; style: &#39;display:none&#39;;<br>
&gt;&gt; &gt; class: &#39;loading&#39;;<br>
&gt;&gt; &gt; script: (html jQuery this<br>
&gt;&gt; &gt; onAjaxStart: (html jQuery this show);<br>
&gt;&gt; &gt; onAjaxStop: (html jQuery this hide));<br>
&gt;&gt; &gt; with: &#39;Loading...&#39;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Now...it works well for some explicit parts where I use ajax. However,<br>
&gt;&gt; &gt; it<br>
&gt;&gt; &gt; doesn&#39;t work for the JQAutocomplete. It my case, the callback to the<br>
&gt;&gt; &gt; autocomplete can take some seconds. It seems #onAjaxStart: is NOT<br>
&gt;&gt; &gt; intercepting what the autocomplete os doing. Could it be because<br>
&gt;&gt; &gt; autocomplete is doing a getJson actually?<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; The key code of the autocomplete is:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; search: aSearchBlock labels: aLabelsBlock callback: aCallbackBlock<br>
&gt;&gt; &gt; &quot;A one argument block aSearchBlock that will be evaluated with the term<br>
&gt;&gt; &gt; the<br>
&gt;&gt; &gt; user currently typed. The block is expected to answer a collection of<br>
&gt;&gt; &gt; objects. aLabelsBlock should answer a string label to be displayed for<br>
&gt;&gt; &gt; each<br>
&gt;&gt; &gt; object. aCallbackBlock is evaluated with the selected object and an ajax<br>
&gt;&gt; &gt; script to be performed.&quot;<br>
&gt;&gt; &gt;  | term mapping |<br>
&gt;&gt; &gt; mapping := IdentityDictionary new.<br>
&gt;&gt; &gt; &quot;assigments to temps don&#39;t work in GS 2.4&#39;<br>
&gt;&gt; &gt; <a href="http://code.google.com/p/glassdb/issues/detail?id=221" target="_blank">http://code.google.com/p/glassdb/issues/detail?id=221</a>&quot;<br>
&gt;&gt; &gt; term := WAValueHolder new.<br>
&gt;&gt; &gt; self source: ((self jQuery getJson<br>
&gt;&gt; &gt; callback: [ :value | term contents: value ]<br>
&gt;&gt; &gt; value: (JSStream on: &#39;request.term&#39;);<br>
&gt;&gt; &gt; text: [ :stream |<br>
&gt;&gt; &gt; stream json: ((aSearchBlock value: term contents) asArray collect: [<br>
&gt;&gt; &gt; :object |<br>
&gt;&gt; &gt; GRSmallDictionary new<br>
&gt;&gt; &gt; at: &#39;label&#39; put: (aLabelsBlock value: object);<br>
&gt;&gt; &gt; at: &#39;index&#39; put: (mapping at: object ifAbsentPut: [ mapping size + 1 ]);<br>
&gt;&gt; &gt; yourself ]) ];<br>
&gt;&gt; &gt; onSuccess: &#39;response(arguments[0])&#39;;<br>
&gt;&gt; &gt; dataType: &#39;jsonp&#39;) asFunction: #(&#39;request&#39; &#39;response&#39;)).<br>
&gt;&gt; &gt; self onSelect: ((self jQuery ajax<br>
&gt;&gt; &gt; callback: [ :value | term contents: value greaseInteger ]<br>
&gt;&gt; &gt; value: (JSStream on: &#39;ui.item.index&#39;);<br>
&gt;&gt; &gt; script: [ :script |<br>
&gt;&gt; &gt; mapping keysAndValuesDo: [ :object :value |<br>
&gt;&gt; &gt; value = term contents<br>
&gt;&gt; &gt; ifTrue: [ aCallbackBlock value: object value: script ] ] ])<br>
&gt;&gt; &gt; asFunction: #(&#39;event&#39; &#39;ui&#39;))<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Any help would be very appreciated.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Thanks,<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; --<br>
&gt;&gt; &gt; Mariano<br>
&gt;&gt; &gt; <a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt; seaside mailing list<br>
&gt;&gt;<br>
&gt;&gt; &gt; seaside@.squeakfoundation<br>
&gt;&gt;<br>
&gt;&gt; &gt; <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; View this message in context:<br>
&gt;&gt; <a href="http://forum.world.st/JQAutocomplete-and-onAjaxStart-tp4787505p4787543.html" target="_blank">http://forum.world.st/JQAutocomplete-and-onAjaxStart-tp4787505p4787543.html</a><br>
&gt;&gt; Sent from the Seaside General mailing list archive at Nabble.com.<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; seaside mailing list<br>
&gt;&gt; <a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
&gt;&gt; <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Mariano<br>
&gt; <a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; seaside mailing list<br>
&gt; <a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
&gt; <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
&gt;<br>
_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Mariano<br><a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br>
</div></div>