hi i have a code and i use the ajax.updater, and i use a ajax.responsers.register, but when i try to unregister this action to no appear anymor ein the system until when i need call a new one. thi sis the code var actuaMEnu=new Ajax.Updater(''toolbar'', ruta+"/php_files/clases/ Admin/genmenu.php?id="+id+"&subAc="+subAc, { method: ''post''}); var consulta=Ajax.Responders.register({ onCreate: function() { Ajax.activeRequestCount++; $(''toolbar'').hide(); $(''overlay'').style.display = ''block''; }, onComplete: function() { Ajax.activeRequestCount--; $(''toolbar'').show(); $(''overlay'').style.display = ''none''; alert("Complete"); } }); Ajax.Responders.unregister(consulta); but each time that i declare a new ajax.respondders.register, this last code still ar ein memory --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Christophe Porteneuve
2007-Jun-14 08:13 UTC
Re: Ajax.reponder.unregister seems to not work
Hey there, I fail to get what you mean, what your problem is, and what you''re trying to achieve with your code. I can tell you this, though: your code doesn''t work anyway, for several reasons: 1) Responders are intended for global use over a long time. If you need callbacks on a specific request, put the darn callbacks in the specific request''s options, not in Responders. Here''s an all-around cleaner, working version of your code: var actuaMenu = new Ajax.Updater(''toolbar'', ruta + "/php_files/clases/Admin/genmenu.php'', { parameters: { id: id, subAc: subAc }, onCreate: function() { $(''toolbar'').hide(); $(''overlay'').show(); }, onComplete: function() { $(''toolbar'').show(); $(''overlay'').hide(); alert("Complete"); } }); 2) Registering a responder *after* you started a request means you may very well miss on a few callbacks, most specifically onCreate. 3) Requests run asynchronously, so your code registers and then immediately deregisters the responders, making it essentially useless. 4) Ajax.activeRequestCount is already maintained, so don''t mess with it: you''ll break the proper count performed by a Prototype-registered Responder. -- Christophe Porteneuve aka TDD tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
thanks for your help, but i find that the method onCreate:function() not work with this code, but yes the onComplete, do yuo know why could be the problem? Documento sin título ----- Original Message ----- From: "Christophe Porteneuve" <tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org> To: <rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Sent: Thursday, June 14, 2007 5:13 AM Subject: [Rails-spinoffs] Re: Ajax.reponder.unregister seems to not work> > Hey there, > > I fail to get what you mean, what your problem is, and what you''re > trying to achieve with your code. I can tell you this, though: your > code doesn''t work anyway, for several reasons: > > 1) Responders are intended for global use over a long time. If you need > callbacks on a specific request, put the darn callbacks in the specific > request''s options, not in Responders. Here''s an all-around cleaner, > working version of your code: > > var actuaMenu = new Ajax.Updater(''toolbar'', > ruta + "/php_files/clases/Admin/genmenu.php'', { > parameters: { id: id, subAc: subAc }, > onCreate: function() { > $(''toolbar'').hide(); > $(''overlay'').show(); > }, > onComplete: function() { > $(''toolbar'').show(); > $(''overlay'').hide(); > alert("Complete"); > } > }); > > 2) Registering a responder *after* you started a request means you may > very well miss on a few callbacks, most specifically onCreate. > > 3) Requests run asynchronously, so your code registers and then > immediately deregisters the responders, making it essentially useless. > > 4) Ajax.activeRequestCount is already maintained, so don''t mess with it: > you''ll break the proper count performed by a Prototype-registered > Responder. > > > -- > Christophe Porteneuve aka TDD > tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
thanks for your help, but i find that the method onCreate:function() not work with this code, but yes the onComplete, do yuo know why could be the problem? Documento sin título ----- Original Message ----- From: "Christophe Porteneuve" <tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org> To: <rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Sent: Thursday, June 14, 2007 5:13 AM Subject: [Rails-spinoffs] Re: Ajax.reponder.unregister seems to not work> > Hey there, > > I fail to get what you mean, what your problem is, and what you''re > trying to achieve with your code. I can tell you this, though: your > code doesn''t work anyway, for several reasons: > > 1) Responders are intended for global use over a long time. If you need > callbacks on a specific request, put the darn callbacks in the specific > request''s options, not in Responders. Here''s an all-around cleaner, > working version of your code: > > var actuaMenu = new Ajax.Updater(''toolbar'', > ruta + "/php_files/clases/Admin/genmenu.php'', { > parameters: { id: id, subAc: subAc }, > onCreate: function() { > $(''toolbar'').hide(); > $(''overlay'').show(); > }, > onComplete: function() { > $(''toolbar'').show(); > $(''overlay'').hide(); > alert("Complete"); > } > }); > > 2) Registering a responder *after* you started a request means you may > very well miss on a few callbacks, most specifically onCreate. > > 3) Requests run asynchronously, so your code registers and then > immediately deregisters the responders, making it essentially useless. > > 4) Ajax.activeRequestCount is already maintained, so don''t mess with it: > you''ll break the proper count performed by a Prototype-registered > Responder. > > > -- > Christophe Porteneuve aka TDD > tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Christophe Porteneuve
2007-Jun-14 17:04 UTC
Re: Ajax.reponder.unregister seems to not work
Hey, Delfino Mario a écrit :> thanks for your help, but i find that the method onCreate:function() not > work with this code, but yes the onComplete, do yuo know why could be the > problem?Ah, yes, my bad: onCreate is not yet supported on individual instances (it is in the trunk, though). The thing is: you don''t need onCreate on individual instances: just put its code *before* doing "new Ajax.Updater(...", it''s just as good :-) -- Christophe Porteneuve aka TDD tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
thanks, look i download the last version of prototype and now works, thanks for your help Documento sin título ----- Original Message ----- From: "Christophe Porteneuve" <tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org> To: <rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Sent: Thursday, June 14, 2007 2:04 PM Subject: [Rails-spinoffs] Re: Ajax.reponder.unregister seems to not work Hey, Delfino Mario a écrit :> thanks for your help, but i find that the method onCreate:function() not > work with this code, but yes the onComplete, do yuo know why could be the > problem?Ah, yes, my bad: onCreate is not yet supported on individual instances (it is in the trunk, though). The thing is: you don''t need onCreate on individual instances: just put its code *before* doing "new Ajax.Updater(...", it''s just as good :-) -- Christophe Porteneuve aka TDD tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---