[Seaside] Re: JQAutocomplete and #onAjaxStart:

Mariano Martinez Peck marianopeck at gmail.com
Thu Oct 30 01:35:27 UTC 2014


On Wed, Oct 29, 2014 at 8:24 PM, Paul DeBruicker <pdebruic at gmail.com> wrote:

> What jQuery version?
>
> It might be because the #onAjaxStart: and #onAjaxStop: methods should only
> be set on the document for some jQuerys (e.g. >= version 1.8) see:
> http://api.jquery.com/ajaxStart/
>
>
Thanks Paul. I am using 1.11.0. So if I understand what you mean, I guess I
should do instead:

html
div
style: 'display:none';
class: 'quuveLoading';
script: (*html jQuery document *
onAjaxStart: (html jQuery this show);
onAjaxStop: (html jQuery this hide));
with: 'Loading...'


right? still not working thought :(

I tried even a simple 'alert(''aa'');' but still not getting called..

Thanks anyway.


>
>
>
>
> Mariano Martinez Peck wrote
> > Hi guys,
> >
> > My app has a some code (thanks Esteban Lorenzano for sharing it with me)
> > to
> > show a little "Loading..." banner... That is:
> >
> > renderAjaxLoadingDivOn: html
> > html
> > div
> > style: 'display:none';
> > class: 'loading';
> > script: (html jQuery this
> > onAjaxStart: (html jQuery this show);
> > onAjaxStop: (html jQuery this hide));
> > with: 'Loading...'
> >
> >
> > Now...it works well for some explicit parts where I use ajax. However, it
> > doesn't work for the JQAutocomplete. It my case, the callback to the
> > autocomplete can take some seconds. It seems #onAjaxStart: is NOT
> > intercepting what the autocomplete os doing. Could it be because
> > autocomplete is doing a getJson actually?
> >
> > The key code of the autocomplete is:
> >
> > search: aSearchBlock labels: aLabelsBlock callback: aCallbackBlock
> > "A one argument block aSearchBlock that will be evaluated with the term
> > the
> > user currently typed. The block is expected to answer a collection of
> > objects. aLabelsBlock should answer a string label to be displayed for
> > each
> > object. aCallbackBlock is evaluated with the selected object and an ajax
> > script to be performed."
> >  | term mapping |
> > mapping := IdentityDictionary new.
> > "assigments to temps don't work in GS 2.4'
> > http://code.google.com/p/glassdb/issues/detail?id=221"
> > term := WAValueHolder new.
> > self source: ((self jQuery getJson
> > callback: [ :value | term contents: value ]
> > value: (JSStream on: 'request.term');
> > text: [ :stream |
> > stream json: ((aSearchBlock value: term contents) asArray collect: [
> > :object |
> > GRSmallDictionary new
> > at: 'label' put: (aLabelsBlock value: object);
> > at: 'index' put: (mapping at: object ifAbsentPut: [ mapping size + 1 ]);
> > yourself ]) ];
> > onSuccess: 'response(arguments[0])';
> > dataType: 'jsonp') asFunction: #('request' 'response')).
> > self onSelect: ((self jQuery ajax
> > callback: [ :value | term contents: value greaseInteger ]
> > value: (JSStream on: 'ui.item.index');
> > script: [ :script |
> > mapping keysAndValuesDo: [ :object :value |
> > value = term contents
> > ifTrue: [ aCallbackBlock value: object value: script ] ] ])
> > asFunction: #('event' 'ui'))
> >
> >
> > Any help would be very appreciated.
> >
> > Thanks,
> >
> > --
> > Mariano
> > http://marianopeck.wordpress.com
> >
> > _______________________________________________
> > seaside mailing list
>
> > seaside at .squeakfoundation
>
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
>
>
>
> --
> View this message in context:
> http://forum.world.st/JQAutocomplete-and-onAjaxStart-tp4787505p4787543.html
> Sent from the Seaside General mailing list archive at Nabble.com.
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>



-- 
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20141029/0dc7834d/attachment.htm


More information about the seaside mailing list