<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 29, 2014 at 11:16 PM, Paul DeBruicker <span dir="ltr"><<a href="mailto:pdebruic@gmail.com" target="_blank">pdebruic@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">Don't know for sure. Do you send #onAjaxStart: anyplace else?<br>
<br>
<br>
Just for another example - the way I do it is in the footer of my app:<br>
<br>
renderAddLoadScripts: html<br>
html document<br>
addLoadScript:<br>
(html jQuery document<br>
onAjaxStart: (html jQuery class: #spinner) show;<br>
onAjaxStop: (html jQuery class: #spinner) hide;<br>
onAjaxError: (self ajaxErrorHandler asFunction: #('event' 'jqxhr'<br>
'settings' 'exception')))<br>
<br>
<br></blockquote><div><br></div><div>Interesting. Could you share the #ajaxErrorHandler? </div><div> </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">
<br>
<br>
<br>
<br>
Mariano Martinez Peck wrote<br>
> On Wed, Oct 29, 2014 at 10:39 PM, Esteban A. Maringolo &lt;<br>
<br>
> emaringolo@<br>
<div><div class="h5"><br>
> &gt; wrote:<br>
><br>
>> I don't know for autocomplete, but a long time ago I implemented that<br>
>> like<br>
>> 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>
>><br>
><br>
> WTF! that worked!! Thanks Esteban! This works for me:<br>
><br>
> renderAjaxLoadingDivOn: html<br>
> html<br>
> div<br>
> style: 'display:none';<br>
> id: 'loading';<br>
> class: 'loading';<br>
> with: 'Loading...'.<br>
> html document addLoadScript: (JSStream on:<br>
> '$(document).ajaxComplete(function() {$("#loading").hide();})').<br>
> html document addLoadScript: (JSStream on:<br>
> '$(document).ajaxStart(function() {$("#loading").show();})').<br>
><br>
><br>
><br>
> does anyone know what is the difference or why this one works while the<br>
> other does not?<br>
><br>
> Thanks Esteban.<br>
><br>
><br>
> Esteban A. Maringolo<br>
>><br>
>><br>
</div></div>>> 2014-10-29 22:35 GMT-03:00 Mariano Martinez Peck &lt;<br>
<br>
> marianopeck@<br>
<br>
> &gt;:<br>
>> ><br>
>> ><br>
>> > On Wed, Oct 29, 2014 at 8:24 PM, Paul DeBruicker &lt;<br>
<br>
> pdebruic@<br>
<br>
> &gt;<br>
<div><div class="h5">>> wrote:<br>
>> >><br>
>> >> What jQuery version?<br>
>> >><br>
>> >> It might be because the #onAjaxStart: and #onAjaxStop: methods should<br>
>> 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<br>
>> 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<br>
>> 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.<br>
>> 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<br>
>> term<br>
>> >> > the<br>
>> >> > user currently typed. The block is expected to answer a collection<br>
>> of<br>
>> >> > objects. aLabelsBlock should answer a string label to be displayed<br>
>> for<br>
>> >> > each<br>
>> >> > object. aCallbackBlock is evaluated with the selected object and an<br>
>> 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>
>> ]);<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>
>> >><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>
>> >><br>
<br>
</div></div>> seaside@.squeakfoundation<br>
<span class=""><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>
>> ><br>
<br>
</span>> seaside@.squeakfoundation<br>
<span class=""><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>
>><br>
<br>
</span>> seaside@.squeakfoundation<br>
<span class=""><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>
<br>
</span>> 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: <a href="http://forum.world.st/JQAutocomplete-and-onAjaxStart-tp4787505p4787555.html" target="_blank">http://forum.world.st/JQAutocomplete-and-onAjaxStart-tp4787505p4787555.html</a><br>
<div class=""><div class="h5">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>
</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>