Hello,
I''m looking for some help - I''m having problems in getting the
loading
message to disappear - sometimes it disappears, sometimes it doesn''t.
This is the javascript I have:
ajaxContent: function(iTabPos) {
if (isNaN(iTabPos)) return false;
var iTabIndex = this._posToIndex(iTabPos);
var oTab = this.tabs[iTabIndex];
var oPanel = oTab.panel;
//if (str && str.length > 0)
oTab.panel.innerHTML str;
var rand = parseInt(Math.random()*99999999); //
chache buster
var url = ''content.php'';
var param = ''iTabPos='' + iTabPos +
''&rand='' +
rand;
var loading = $(''loading'');
var ajax = new Ajax.Updater(oPanel, url, {
method: ''get'',
evalScripts: true,
parameters: param,
asynchronous: true,
onLoading: function(request) {
Element.show(loading)
}.bind(this),
onComplete: function(request) {
Element.hide(loading);
this.show(iTabPos);
}.bind(this),
onFailure: function(request) {
}.bind(this)
})
}
And this is the PHP
$iTabPos = (isset($_REQUEST[''iTabPos'']) ?
$_REQUEST[''iTabPos''] :
'''');
switch ($iTabPos) {
case 1:
echo "This is the external AJAX content for panel 1";
break;
case 2:
echo "This is the external AJAX content for panel 2";
break;
default:
echo "panel not found";
}
What is it that I''m doing wrong - thank you in advance for your help.
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
I faced the same issue, but was never able to resolve it using this.
Maybe it was because I was testing using localhost and the responses were too
fast..but dunno!
Then I tried doing it using the following -
Ajax.Responders.register({
onCreate: function(request) {
Element.show(loading);
},
onComplete: function(request) {
Element.hide(loading);
}
});
This was my global spinner image. This always worked fine.
Maybe you would want to give it a shot.
Thank you,
Mandy.
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Thanks for replying - so you were using Ajax.Responders instead of the
Ajax.Updater, right?
-----Original Message-----
From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
[mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]
On Behalf Of Maninder,
Singh
Sent: Friday, April 07, 2006 11:23 AM
To: mail-yVS5avHIROZWk0Htik3J/w@public.gmane.org;
rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
Subject: RE: [Rails-spinoffs] ajax loading message
I faced the same issue, but was never able to resolve it using this.
Maybe it was because I was testing using localhost and the responses were
too fast..but dunno!
Then I tried doing it using the following -
Ajax.Responders.register({
onCreate: function(request) {
Element.show(loading);
},
onComplete: function(request) {
Element.hide(loading);
}
});
This was my global spinner image. This always worked fine.
Maybe you would want to give it a shot.
Thank you,
Mandy.
In Ajax.Responders you can register functions which get called in on the specified events of every ajax request (same as assigning the functions in the options of every request). Improved version of the onComplete could be: if(Ajax.activeRequestCount < 1) Element.hide(loading); In the case of having multiple requests running at the same time hth sigi On 4/7/06, Marco M. Jaeger <mail-yVS5avHIROZWk0Htik3J/w@public.gmane.org> wrote:> > Thanks for replying - so you were using Ajax.Responders instead of the > Ajax.Updater, right? > > -----Original Message----- > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of > Maninder, > Singh > Sent: Friday, April 07, 2006 11:23 AM > To: mail-yVS5avHIROZWk0Htik3J/w@public.gmane.org; rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: RE: [Rails-spinoffs] ajax loading message > > I faced the same issue, but was never able to resolve it using this. > > Maybe it was because I was testing using localhost and the responses were > too fast..but dunno! > > Then I tried doing it using the following - > > Ajax.Responders.register({ > onCreate: function(request) { > Element.show(loading); > }, > onComplete: function(request) { > Element.hide(loading); > } > }); > > This was my global spinner image. This always worked fine. > > Maybe you would want to give it a shot. > > Thank you, > Mandy. > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >-- Mit freundlichen Grüßen Siegfried Puchbauer _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
hi,
maybe it''s only sth I did wrong but when I used global registering for
Ajax events it was somehow overwriting my onComplete tasks defined in
Ajax.Updater..
And I needed both of them to trigger. I''ve got some ajax actions with
different behaviour onComplete but all of these actions needed
''spinner/indicator'' so I thought global registering would be
good..
Is it normal behaviour ?
greetings to all,
Andrzej
----- Original Message -----
From: Maninder, Singh
To: mail-yVS5avHIROZWk0Htik3J/w@public.gmane.org ;
rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
Sent: Friday, April 07, 2006 11:22 AM
Subject: RE: [Rails-spinoffs] ajax loading message
I faced the same issue, but was never able to resolve it using this.
Maybe it was because I was testing using localhost and the responses were too
fast..but dunno!
Then I tried doing it using the following -
Ajax.Responders.register({
onCreate: function(request) {
Element.show(loading);
},
onComplete: function(request) {
Element.hide(loading);
}
});
This was my global spinner image. This always worked fine.
Maybe you would want to give it a shot.
Thank you,
Mandy.
------------------------------------------------------------------------------
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
On 4/7/06, Andrzej Rumpfelt <arumpfelt-2InuVDLKURjVItvQsEIGlw@public.gmane.org> wrote:> > hi, > > maybe it''s only sth I did wrong but when I used global registering for > Ajax events it was somehow overwriting my onComplete tasks defined in > Ajax.Updater.. > And I needed both of them to trigger. I''ve got some ajax actions with > different behaviour onComplete but all of these actions needed > ''spinner/indicator'' so I thought global registering would be good.. > > Is it normal behaviour ? >No, is it possible that some of your global registered events handlers raise an error or exception? greetings to all,> Andrzej > > ----- Original Message ----- > *From:* Maninder, Singh <mandiv-W2hqgAdRMsX2eFz/2MeuCQ@public.gmane.org> > *To:* mail-yVS5avHIROZWk0Htik3J/w@public.gmane.org ; rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > *Sent:* Friday, April 07, 2006 11:22 AM > *Subject:* RE: [Rails-spinoffs] ajax loading message > > I faced the same issue, but was never able to resolve it using this. > > Maybe it was because I was testing using localhost and the responses were > too fast..but dunno! > > Then I tried doing it using the following - > > Ajax.Responders.register({ > onCreate: function(request) { > Element.show(loading); > }, > onComplete: function(request) { > Element.hide(loading); > } > }); > > This was my global spinner image. This always worked fine. > > Maybe you would want to give it a shot. > > Thank you, > Mandy. > > ------------------------------ > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > >-- Mit freundlichen Grüßen Siegfried Puchbauer _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
I will try with some more tests but I don''t think that there is sth
wrong with my global handlers - I used the code from:
http://www.sergiopereira.com/articles/prototype.js.html#Ajax.Responders
but I will check it deeper, thanks
----- Original Message -----
From: Siegfried Puchbauer
To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
Sent: Friday, April 07, 2006 11:35 AM
Subject: Re: [Rails-spinoffs] ajax loading message
On 4/7/06, Andrzej Rumpfelt
<arumpfelt-2InuVDLKURjVItvQsEIGlw@public.gmane.org> wrote:
hi,
maybe it''s only sth I did wrong but when I used global registering
for Ajax events it was somehow overwriting my onComplete tasks defined in
Ajax.Updater..
And I needed both of them to trigger. I''ve got some ajax actions
with different behaviour onComplete but all of these actions needed
''spinner/indicator'' so I thought global registering would be
good..
Is it normal behaviour ?
No, is it possible that some of your global registered events handlers raise
an error or exception?
greetings to all,
Andrzej
----- Original Message -----
From: Maninder, Singh
To: mail-yVS5avHIROZWk0Htik3J/w@public.gmane.org ;
rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
Sent: Friday, April 07, 2006 11:22 AM
Subject: RE: [Rails-spinoffs] ajax loading message
I faced the same issue, but was never able to resolve it using this.
Maybe it was because I was testing using localhost and the responses were
too fast..but dunno!
Then I tried doing it using the following -
Ajax.Responders.register({
onCreate: function(request) {
Element.show(loading);
},
onComplete: function(request) {
Element.hide(loading);
}
});
This was my global spinner image. This always worked fine.
Maybe you would want to give it a shot.
Thank you,
Mandy.
----------------------------------------------------------------------------
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
--
Mit freundlichen Grüßen
Siegfried Puchbauer
------------------------------------------------------------------------------
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs