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