[Seaside] jQuery anchor and multiple div update

Karsten Kusche karsten at heeg.de
Wed Jun 5 13:06:46 UTC 2013


Hi Dario,  

please read the documentation about ajaxError: http://api.jquery.com/ajaxError/ it suggests that you check the parameters to the function.  
You can either convert the script to a function by sending #asFunction: and provide an array of variable names, or you add that script in your file library like so:
jQuery(function($){
$(document).ajaxError(function(event, jqXHR, ajaxSettings, thrownError) {
alert("error " + thrownError);
});
});
That'll also register the event handler and be not so difficult to read. Downside is that you cannot easily send that back to the server as you don't have a callback URL at hand, but for debugging purposes that should be fine.

Kind Regards
Karsten

--  
Karsten Kusche - Dipl. Inf. (FH) - karsten at heeg.de
Georg Heeg eK - Köthen
Handelsregister: Amtsgericht Dortmund A 12812  


Am Mittwoch, 5. Juni 2013 um 14:55 schrieb dtrussardi at tiscali.it:

> Ciao,  
>  
> with the Ryan changes all works fine.
>  
>  
> > Hi Dario,  
> > I think the trouble is that when you have two or more ajax scripts to be run you are not guaranteed which will run first. If you use a callback and send serializeThis to the ajax object, it runs before any scripts:
> >   
> > html anchor
> >    callback: [ self setIndex: aValue ];
> >    onClick: (html jQuery ajax
> >       serializeThis;
> >       script: [ :s | (s jquery: anId) html: [ :h | self renderStuffOn: h ].
> >          s << (s jQuery: anId2) html: [ :h | self renderSomeOtherStuffOn: h ] ]...
>  
> I think the use of callback is more clear but some test id do don't solve the problematic.
>  
> At the top of my rendering i have this code :
>  
> html document addLoadScript: (html jQuery ajaxSetup onError: (html javascript alert: 'The session erase a jq error.' ))
>  
> and when i work with callback the system erase the alert.
>  
> How i can use the callback in this problematic, or the Ryan indications is the only solution.
>  
> Thanks,
>  
> Dario
>  
> > Regards,  
> > John
> > On Wed, Jun 5, 2013 at 4:40 AM, <dtrussardi at tiscali.it (mailto:dtrussardi at tiscali.it)> wrote:
> > > Ciao,  
> > >  
> > > i have  a anchor based on this code:  
> > >  
> > > html anchor
> > > script: (html jQuery this button
> > > text: true;
> > > primaryIcon:  'ui-icon-circle-plus'
> > > title: 'Successivo');
> > >  
> > > onClick: (html jQuery ajax  
> > > ( html jQuery ajax  
> > >           script: [ :s | s << (s jQuery:  #'base') load html:[:h| "A" self incrementaIndex: true.  
> > > "B1" (self renderingBaseOn:  h)].  
> > >  
> > > s << (s jQuery: #'orarioRiferimento') load html:[:h|  "B2" ( self renderOrarioRiferimentoOn: h)]]);  
> > > with: '>'.
> > >  
> > >  
> > > My objective when a user click on this anchor is:  
> > >  
> > > A)   update a index  with the   self incrementaIndex: true.  
> > >  
> > > B1)  update the div #base with:    self renderingBaseOn: h  
> > >  
> > > B2) update the div #orarioRiferimento  with:  self renderOrarioRiferimentoOn: h  
> > >  
> > >  
> > > Where the B1 - B2  rendering is based on the index state.  
> > >  
> > > Now i have a strange behavior because sometime the B2  div #orarioRiferimento  renderings is not aligned to the index.  
> > >  
> > > As if the onClick script action  is not execute in the definition sequence.  
> > >  
> > >  
> > > Any suggestions ?  
> > >  
> > > What is the right definition to solve this problematic type ?  
> > >  
> > > Thanks,  
> > >  
> > > Dario  
> > >  
> > >  
> > >  
> > > _______________________________________________
> > > seaside mailing list
> > > seaside at lists.squeakfoundation.org (mailto:seaside at lists.squeakfoundation.org)
> > > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> > >  
> >  
> >  
> >  
> > --  
> > jmck.seasidehosting.st (http://jmck.seasidehosting.st/) _______________________________________________
> > seaside mailing list
> > seaside at lists.squeakfoundation.org (mailto:seaside at lists.squeakfoundation.org)
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>  
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org (mailto:seaside at lists.squeakfoundation.org)
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>  
>  


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20130605/cb3bb231/attachment-0001.htm


More information about the seaside mailing list