Hi, I am trying to apply multiple statements in a :complete for a link_to_remote. The first statement performs the visual effect drop out. The second statement, removes that element using update_element_function :action => :remove. When both statements are present, the drop out effect does not work. Both statements work independently. There are no javascript errors. I believe this may be due to how the browser renders javascript statements. It seems that all javascript within a :complete tag is rendered simultaneously. So, the drop out does not show because the element is already removed. Can anyone verify this? Is there a workaround? Thanks, Tom
could you post the relevant piece of code in you view? Tom Davies wrote:>Hi, > >I am trying to apply multiple statements in a :complete for a >link_to_remote. The first statement performs the visual effect drop >out. The second statement, removes that element using >update_element_function :action => :remove. > >When both statements are present, the drop out effect does not work. >Both statements work independently. There are no javascript errors. > >I believe this may be due to how the browser renders javascript >statements. It seems that all javascript within a :complete tag is >rendered simultaneously. So, the drop out does not show because the >element is already removed. Can anyone verify this? Is there a >workaround? > >Thanks, >Tom >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails > > >
Sure. Here are some snippets of my code: In the main view (there is a link_to_remote for each gift_<id> element): <%= link_to_remote "Delete", {:confirm => "Are you sure?", :url => { :action => "delete_gift", :id => gift, :page => @params[:page]}, :complete => [visual_effect(:drop_out,"gift_#{gift.id}"), evaluate_remote_response]}, {:href => url_for(:action => "delete_gift", :id => gift, :page => @params[:page])}%> In the remote response partial: <%= update_element_function( "gift_#{@params[:id]}", :action => :remove) %> Thanks, Tom On 10/18/05, Francois Paul <francois-VKbYeNyhmt9BDgjK7y7TUQ@public.gmane.org> wrote:> could you post the relevant piece of code in you view? > > > Tom Davies wrote: > > >Hi, > > > >I am trying to apply multiple statements in a :complete for a > >link_to_remote. The first statement performs the visual effect drop > >out. The second statement, removes that element using > >update_element_function :action => :remove. > > > >When both statements are present, the drop out effect does not work. > >Both statements work independently. There are no javascript errors. > > > >I believe this may be due to how the browser renders javascript > >statements. It seems that all javascript within a :complete tag is > >rendered simultaneously. So, the drop out does not show because the > >element is already removed. Can anyone verify this? Is there a > >workaround? > > > >Thanks, > >Tom > >_______________________________________________ > >Rails mailing list > >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Hi Francois, Thanks for your response. However, the visual effect was already adding the semi-colon. I tried adding an extra one, but no luck. In case it helps, here is the actual onComplete javascript that gets generated: onComplete:function(request){new Effect.DropOut(''gift_1'',{});eval(request.responseText)} Tom On 10/18/05, Francois Paul <francois-VKbYeNyhmt9BDgjK7y7TUQ@public.gmane.org> wrote:> > :complete => > [visual_effect(:drop_out,"gift_#{gift.id}"), > evaluate_remote_response]}, > > as I understand it :complete renders javascript so you have to seperate > your functions with an javascript end of command ( ; ). > > maybe try: > > :complete => visual_effect(:drop_out,"gift_#{gift.id}") + > ";" + evaluate_remote_response}, > > > no guarantee - not tested > > > > regards, > Francois > > > > Tom Davies wrote: > Sure. Here are some snippets of my code: > > In the main view (there is a link_to_remote for each gift_<id> element): > > <%= link_to_remote "Delete", {:confirm => "Are you sure?", > :url => { :action => "delete_gift", :id => gift, :page => > @params[:page]}, > :complete => [visual_effect(:drop_out,"gift_#{gift.id}"), > evaluate_remote_response]}, > {:href => url_for(:action => "delete_gift", :id => gift, > :page => @params[:page])}%> > > In the remote response partial: > > <%= update_element_function( > "gift_#{@params[:id]}", > :action => :remove) %> > > Thanks, > Tom > > On 10/18/05, Francois Paul <francois-VKbYeNyhmt9BDgjK7y7TUQ@public.gmane.org> wrote: > > > could you post the relevant piece of code in you view? > > > Tom Davies wrote: > > > > Hi, > > I am trying to apply multiple statements in a :complete for a > link_to_remote. The first statement performs the visual effect drop > out. The second statement, removes that element using > update_element_function :action => :remove. > > When both statements are present, the drop out effect does not work. > Both statements work independently. There are no javascript errors. > > I believe this may be due to how the browser renders javascript > statements. It seems that all javascript within a :complete tag is > rendered simultaneously. So, the drop out does not show because the > element is already removed. Can anyone verify this? Is there a > workaround? > > Thanks, > Tom > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > >
Tom, Can''t you put the :complete statements in a separate javascript function, which you call in the :complete statement? Jaap On 10/18/05, Tom Davies <atomgiant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Francois, > > Thanks for your response. However, the visual effect was already > adding the semi-colon. I tried adding an extra one, but no luck. > > In case it helps, here is the actual onComplete javascript that gets generated: > > onComplete:function(request){new > Effect.DropOut(''gift_1'',{});eval(request.responseText)} > > > Tom > > On 10/18/05, Francois Paul <francois-VKbYeNyhmt9BDgjK7y7TUQ@public.gmane.org> wrote: > > > :complete => > > [visual_effect(:drop_out,"gift_#{gift.id}"), > > evaluate_remote_response]}, > > > > as I understand it :complete renders javascript so you have to seperate > > your functions with an javascript end of command ( ; ). > > > > maybe try: > > > > :complete => visual_effect(:drop_out,"gift_#{gift.id}") + > > ";" + evaluate_remote_response}, > > > > > > no guarantee - not tested > > > > > > > > regards, > > Francois > > > > > > > > Tom Davies wrote: > > Sure. Here are some snippets of my code: > > > > In the main view (there is a link_to_remote for each gift_<id> element): > > > > <%= link_to_remote "Delete", {:confirm => "Are you sure?", > > :url => { :action => "delete_gift", :id => gift, :page => > > @params[:page]}, > > :complete => [visual_effect(:drop_out,"gift_#{gift.id}"), > > evaluate_remote_response]}, > > {:href => url_for(:action => "delete_gift", :id => gift, > > :page => @params[:page])}%> > > > > In the remote response partial: > > > > <%= update_element_function( > > "gift_#{@params[:id]}", > > :action => :remove) %> > > > > Thanks, > > Tom > > > > On 10/18/05, Francois Paul <francois-VKbYeNyhmt9BDgjK7y7TUQ@public.gmane.org> wrote: > > > > > > could you post the relevant piece of code in you view? > > > > > > Tom Davies wrote: > > > > > > > > Hi, > > > > I am trying to apply multiple statements in a :complete for a > > link_to_remote. The first statement performs the visual effect drop > > out. The second statement, removes that element using > > update_element_function :action => :remove. > > > > When both statements are present, the drop out effect does not work. > > Both statements work independently. There are no javascript errors. > > > > I believe this may be due to how the browser renders javascript > > statements. It seems that all javascript within a :complete tag is > > rendered simultaneously. So, the drop out does not show because the > > element is already removed. Can anyone verify this? Is there a > > workaround? > > > > Thanks, > > Tom > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Hi Jaap, I could do that, but I am not sure it would behave differently. Both statements are executing now, but the problem is that they seem to be executing simultaneously. Actually, I think I just determined the root of the problem. The drop_out effect takes place over some interval of time. As soon as the drop_out is started, the evaluate_remote_response removes the element that is dropping out before it can finish dropping out. Perhaps what I am after is a delay before the evaluate_remote_response, to allow enough time for the drop out to finish. So, my new question is: Is this delay functionality a part of RoR''s AJAX support? I suppose I could write my own delay function as well, but I don''t want to re-invent the wheel. Alternatively, I think I could save myself a lot of grief by handling deleted elements gracefully on the server-side, and not actually deleting the element on the client side. Tom On 10/18/05, Jaap Schreurs <jhschreurs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Tom, > > Can''t you put the :complete statements in a separate javascript > function, which you call in the :complete statement? > > Jaap > > On 10/18/05, Tom Davies <atomgiant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi Francois, > > > > Thanks for your response. However, the visual effect was already > > adding the semi-colon. I tried adding an extra one, but no luck. > > > > In case it helps, here is the actual onComplete javascript that gets generated: > > > > onComplete:function(request){new > > Effect.DropOut(''gift_1'',{});eval(request.responseText)} > > > > > > Tom > > > > On 10/18/05, Francois Paul <francois-VKbYeNyhmt9BDgjK7y7TUQ@public.gmane.org> wrote: > > > > :complete => > > > [visual_effect(:drop_out,"gift_#{gift.id}"), > > > evaluate_remote_response]}, > > > > > > as I understand it :complete renders javascript so you have to seperate > > > your functions with an javascript end of command ( ; ). > > > > > > maybe try: > > > > > > :complete => visual_effect(:drop_out,"gift_#{gift.id}") + > > > ";" + evaluate_remote_response}, > > > > > > > > > no guarantee - not tested > > > > > > > > > > > > regards, > > > Francois > > > > > > > > > > > > Tom Davies wrote: > > > Sure. Here are some snippets of my code: > > > > > > In the main view (there is a link_to_remote for each gift_<id> element): > > > > > > <%= link_to_remote "Delete", {:confirm => "Are you sure?", > > > :url => { :action => "delete_gift", :id => gift, :page => > > > @params[:page]}, > > > :complete => [visual_effect(:drop_out,"gift_#{gift.id}"), > > > evaluate_remote_response]}, > > > {:href => url_for(:action => "delete_gift", :id => gift, > > > :page => @params[:page])}%> > > > > > > In the remote response partial: > > > > > > <%= update_element_function( > > > "gift_#{@params[:id]}", > > > :action => :remove) %> > > > > > > Thanks, > > > Tom > > > > > > On 10/18/05, Francois Paul <francois-VKbYeNyhmt9BDgjK7y7TUQ@public.gmane.org> wrote: > > > > > > > > > could you post the relevant piece of code in you view? > > > > > > > > > Tom Davies wrote: > > > > > > > > > > > > Hi, > > > > > > I am trying to apply multiple statements in a :complete for a > > > link_to_remote. The first statement performs the visual effect drop > > > out. The second statement, removes that element using > > > update_element_function :action => :remove. > > > > > > When both statements are present, the drop out effect does not work. > > > Both statements work independently. There are no javascript errors. > > > > > > I believe this may be due to how the browser renders javascript > > > statements. It seems that all javascript within a :complete tag is > > > rendered simultaneously. So, the drop out does not show because the > > > element is already removed. Can anyone verify this? Is there a > > > workaround? > > > > > > Thanks, > > > Tom > > > _______________________________________________ > > > Rails mailing list > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
I had the same kind of synchronisation problem using two visual effects, one on loading, the other one on complete. I manage to synchronize somehow the effects by calling the cancel method on first effect before starting the second. I saw there was also callbacks on effect, so you could use ''afterFinish'' to synchronize yours. Rom 2005/10/18, Tom Davies <atomgiant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> Hi Jaap, > > I could do that, but I am not sure it would behave differently. Both > statements are executing now, but the problem is that they seem to be > executing simultaneously. > > Actually, I think I just determined the root of the problem. The > drop_out effect takes place over some interval of time. As soon as > the drop_out is started, the evaluate_remote_response removes the > element that is dropping out before it can finish dropping out. > Perhaps what I am after is a delay before the > evaluate_remote_response, to allow enough time for the drop out to > finish. > > So, my new question is: Is this delay functionality a part of RoR''s > AJAX support? > > I suppose I could write my own delay function as well, but I don''t > want to re-invent the wheel. > > Alternatively, I think I could save myself a lot of grief by handling > deleted elements gracefully on the server-side, and not actually > deleting the element on the client side. > > Tom > > On 10/18/05, Jaap Schreurs <jhschreurs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Tom, > > > > Can''t you put the :complete statements in a separate javascript > > function, which you call in the :complete statement? > > > > Jaap > > > > On 10/18/05, Tom Davies <atomgiant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi Francois, > > > > > > Thanks for your response. However, the visual effect was already > > > adding the semi-colon. I tried adding an extra one, but no luck. > > > > > > In case it helps, here is the actual onComplete javascript that gets generated: > > > > > > onComplete:function(request){new > > > Effect.DropOut(''gift_1'',{});eval(request.responseText)} > > > > > > > > > Tom > > > > > > On 10/18/05, Francois Paul <francois-VKbYeNyhmt9BDgjK7y7TUQ@public.gmane.org> wrote: > > > > > :complete => > > > > [visual_effect(:drop_out,"gift_#{gift.id}"), > > > > evaluate_remote_response]}, > > > > > > > > as I understand it :complete renders javascript so you have to seperate > > > > your functions with an javascript end of command ( ; ). > > > > > > > > maybe try: > > > > > > > > :complete => visual_effect(:drop_out,"gift_#{gift.id}") + > > > > ";" + evaluate_remote_response}, > > > > > > > > > > > > no guarantee - not tested > > > > > > > > > > > > > > > > regards, > > > > Francois > > > > > > > > > > > > > > > > Tom Davies wrote: > > > > Sure. Here are some snippets of my code: > > > > > > > > In the main view (there is a link_to_remote for each gift_<id> element): > > > > > > > > <%= link_to_remote "Delete", {:confirm => "Are you sure?", > > > > :url => { :action => "delete_gift", :id => gift, :page => > > > > @params[:page]}, > > > > :complete => [visual_effect(:drop_out,"gift_#{gift.id}"), > > > > evaluate_remote_response]}, > > > > {:href => url_for(:action => "delete_gift", :id => gift, > > > > :page => @params[:page])}%> > > > > > > > > In the remote response partial: > > > > > > > > <%= update_element_function( > > > > "gift_#{@params[:id]}", > > > > :action => :remove) %> > > > > > > > > Thanks, > > > > Tom > > > > > > > > On 10/18/05, Francois Paul <francois-VKbYeNyhmt9BDgjK7y7TUQ@public.gmane.org> wrote: > > > > > > > > > > > > could you post the relevant piece of code in you view? > > > > > > > > > > > > Tom Davies wrote: > > > > > > > > > > > > > > > > Hi, > > > > > > > > I am trying to apply multiple statements in a :complete for a > > > > link_to_remote. The first statement performs the visual effect drop > > > > out. The second statement, removes that element using > > > > update_element_function :action => :remove. > > > > > > > > When both statements are present, the drop out effect does not work. > > > > Both statements work independently. There are no javascript errors. > > > > > > > > I believe this may be due to how the browser renders javascript > > > > statements. It seems that all javascript within a :complete tag is > > > > rendered simultaneously. So, the drop out does not show because the > > > > element is already removed. Can anyone verify this? Is there a > > > > workaround? > > > > > > > > Thanks, > > > > Tom > > > > _______________________________________________ > > > > Rails mailing list > > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > Rails mailing list > > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- -Tout ce qui n''est pas donné est perdu - Hasari Pal
Use the queue option on both effects (with Rails 0.14+), e.g. :oncomplete => visual_effect(:drop_out,"element_id",:queue => "''end''") (untested!) I''m working on a patch to get rid of the extra '' for the :queue option. This will make the effects queued up, so the second effect starts when the first effect finishes. Thomas Am 29.10.2005 um 19:25 schrieb Romuald du Song:> I had the same kind of synchronisation problem using two visual > effects, one on loading, > the other one on complete. > I manage to synchronize somehow the effects by calling the cancel > method on first effect > before starting the second. I saw there was also callbacks on effect, > so you could > use ''afterFinish'' to synchronize yours. > > Rom > > 2005/10/18, Tom Davies <atomgiant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > >> Hi Jaap, >> >> I could do that, but I am not sure it would behave differently. Both >> statements are executing now, but the problem is that they seem to be >> executing simultaneously. >> >> Actually, I think I just determined the root of the problem. The >> drop_out effect takes place over some interval of time. As soon as >> the drop_out is started, the evaluate_remote_response removes the >> element that is dropping out before it can finish dropping out. >> Perhaps what I am after is a delay before the >> evaluate_remote_response, to allow enough time for the drop out to >> finish. >> >> So, my new question is: Is this delay functionality a part of RoR''s >> AJAX support? >> >> I suppose I could write my own delay function as well, but I don''t >> want to re-invent the wheel. >> >> Alternatively, I think I could save myself a lot of grief by handling >> deleted elements gracefully on the server-side, and not actually >> deleting the element on the client side. >> >> Tom >> >> On 10/18/05, Jaap Schreurs <jhschreurs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >>> Tom, >>> >>> Can''t you put the :complete statements in a separate javascript >>> function, which you call in the :complete statement? >>> >>> Jaap >>> >>> On 10/18/05, Tom Davies <atomgiant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> >>>> Hi Francois, >>>> >>>> Thanks for your response. However, the visual effect was already >>>> adding the semi-colon. I tried adding an extra one, but no luck. >>>> >>>> In case it helps, here is the actual onComplete javascript that >>>> gets generated: >>>> >>>> onComplete:function(request){new >>>> Effect.DropOut(''gift_1'',{});eval(request.responseText)} >>>> >>>> >>>> Tom >>>> >>>> On 10/18/05, Francois Paul <francois-VKbYeNyhmt9BDgjK7y7TUQ@public.gmane.org> wrote: >>>> >>>>>> :complete => >>>>>> >>>>> [visual_effect(:drop_out,"gift_#{gift.id}"), >>>>> evaluate_remote_response]}, >>>>> >>>>> as I understand it :complete renders javascript so you have to >>>>> seperate >>>>> your functions with an javascript end of command ( ; ). >>>>> >>>>> maybe try: >>>>> >>>>> :complete => visual_effect(:drop_out,"gift_#{gift.id}") + >>>>> ";" + evaluate_remote_response}, >>>>> >>>>> >>>>> no guarantee - not tested >>>>> >>>>> >>>>> >>>>> regards, >>>>> Francois >>>>> >>>>> >>>>> >>>>> Tom Davies wrote: >>>>> Sure. Here are some snippets of my code: >>>>> >>>>> In the main view (there is a link_to_remote for each gift_<id> >>>>> element): >>>>> >>>>> <%= link_to_remote "Delete", {:confirm => "Are you sure?", >>>>> :url => { :action => "delete_gift", :id => gift, :page => >>>>> @params[:page]}, >>>>> :complete => [visual_effect(:drop_out,"gift_#{gift.id}"), >>>>> evaluate_remote_response]}, >>>>> {:href => url_for(:action => "delete_gift", :id => gift, >>>>> :page => @params[:page])}%> >>>>> >>>>> In the remote response partial: >>>>> >>>>> <%= update_element_function( >>>>> "gift_#{@params[:id]}", >>>>> :action => :remove) %> >>>>> >>>>> Thanks, >>>>> Tom >>>>> >>>>> On 10/18/05, Francois Paul <francois-VKbYeNyhmt9BDgjK7y7TUQ@public.gmane.org> wrote: >>>>> >>>>> >>>>> could you post the relevant piece of code in you view? >>>>> >>>>> >>>>> Tom Davies wrote: >>>>> >>>>> >>>>> >>>>> Hi, >>>>> >>>>> I am trying to apply multiple statements in a :complete for a >>>>> link_to_remote. The first statement performs the visual effect >>>>> drop >>>>> out. The second statement, removes that element using >>>>> update_element_function :action => :remove. >>>>> >>>>> When both statements are present, the drop out effect does not >>>>> work. >>>>> Both statements work independently. There are no javascript >>>>> errors. >>>>> >>>>> I believe this may be due to how the browser renders javascript >>>>> statements. It seems that all javascript within a :complete tag is >>>>> rendered simultaneously. So, the drop out does not show because >>>>> the >>>>> element is already removed. Can anyone verify this? Is there a >>>>> workaround? >>>>> >>>>> Thanks, >>>>> Tom >>>>> _______________________________________________ >>>>> Rails mailing list >>>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>>> http://lists.rubyonrails.org/mailman/listinfo/rails >>>>> >>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> Rails mailing list >>>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>>> http://lists.rubyonrails.org/mailman/listinfo/rails >>>>> >>>>> >>>>> >>>>> >>>>> >>>> _______________________________________________ >>>> Rails mailing list >>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>> http://lists.rubyonrails.org/mailman/listinfo/rails >>>> >>>> >>> _______________________________________________ >>> Rails mailing list >>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>> http://lists.rubyonrails.org/mailman/listinfo/rails >>> >>> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> > > > -- > -Tout ce qui n''est pas donné est perdu - Hasari Pal > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
The change (+test) is included with Rails changeset 2807: http://dev.rubyonrails.com/changeset/2807 Cheers, Thomas Am 29.10.2005 um 19:44 schrieb Thomas Fuchs:> Use the queue option on both effects (with Rails 0.14+), e.g. > > :oncomplete => visual_effect(:drop_out,"element_id",:queue => "''end''") > > (untested!) > > I''m working on a patch to get rid of the extra '' for the :queue > option. > > This will make the effects queued up, so the second effect starts > when the first effect finishes. > > Thomas > > Am 29.10.2005 um 19:25 schrieb Romuald du Song: > > >> I had the same kind of synchronisation problem using two visual >> effects, one on loading, >> the other one on complete. >> I manage to synchronize somehow the effects by calling the cancel >> method on first effect >> before starting the second. I saw there was also callbacks on effect, >> so you could >> use ''afterFinish'' to synchronize yours. >> >> Rom >> >> 2005/10/18, Tom Davies <atomgiant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: >> >> >>> Hi Jaap, >>> >>> I could do that, but I am not sure it would behave differently. Both >>> statements are executing now, but the problem is that they seem >>> to be >>> executing simultaneously. >>> >>> Actually, I think I just determined the root of the problem. The >>> drop_out effect takes place over some interval of time. As soon as >>> the drop_out is started, the evaluate_remote_response removes the >>> element that is dropping out before it can finish dropping out. >>> Perhaps what I am after is a delay before the >>> evaluate_remote_response, to allow enough time for the drop out to >>> finish. >>> >>> So, my new question is: Is this delay functionality a part of RoR''s >>> AJAX support? >>> >>> I suppose I could write my own delay function as well, but I don''t >>> want to re-invent the wheel. >>> >>> Alternatively, I think I could save myself a lot of grief by >>> handling >>> deleted elements gracefully on the server-side, and not actually >>> deleting the element on the client side. >>> >>> Tom >>> >>> On 10/18/05, Jaap Schreurs <jhschreurs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> >>> >>>> Tom, >>>> >>>> Can''t you put the :complete statements in a separate javascript >>>> function, which you call in the :complete statement? >>>> >>>> Jaap >>>> >>>> On 10/18/05, Tom Davies <atomgiant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>>> >>>> >>>>> Hi Francois, >>>>> >>>>> Thanks for your response. However, the visual effect was already >>>>> adding the semi-colon. I tried adding an extra one, but no luck. >>>>> >>>>> In case it helps, here is the actual onComplete javascript that >>>>> gets generated: >>>>> >>>>> onComplete:function(request){new >>>>> Effect.DropOut(''gift_1'',{});eval(request.responseText)} >>>>> >>>>> >>>>> Tom >>>>> >>>>> On 10/18/05, Francois Paul <francois-VKbYeNyhmt9BDgjK7y7TUQ@public.gmane.org> wrote: >>>>> >>>>> >>>>>>> :complete => >>>>>>> >>>>>>> >>>>>> [visual_effect(:drop_out,"gift_#{gift.id}"), >>>>>> evaluate_remote_response]}, >>>>>> >>>>>> as I understand it :complete renders javascript so you have >>>>>> to seperate >>>>>> your functions with an javascript end of command ( ; ). >>>>>> >>>>>> maybe try: >>>>>> >>>>>> :complete => visual_effect(:drop_out,"gift_#{gift.id}") + >>>>>> ";" + evaluate_remote_response}, >>>>>> >>>>>> >>>>>> no guarantee - not tested >>>>>> >>>>>> >>>>>> >>>>>> regards, >>>>>> Francois >>>>>> >>>>>> >>>>>> >>>>>> Tom Davies wrote: >>>>>> Sure. Here are some snippets of my code: >>>>>> >>>>>> In the main view (there is a link_to_remote for each gift_<id> >>>>>> element): >>>>>> >>>>>> <%= link_to_remote "Delete", {:confirm => "Are you sure?", >>>>>> :url => { :action => "delete_gift", :id => gift, :page => >>>>>> @params[:page]}, >>>>>> :complete => [visual_effect(:drop_out,"gift_#{gift.id}"), >>>>>> evaluate_remote_response]}, >>>>>> {:href => url_for(:action => "delete_gift", :id => gift, >>>>>> :page => @params[:page])}%> >>>>>> >>>>>> In the remote response partial: >>>>>> >>>>>> <%= update_element_function( >>>>>> "gift_#{@params[:id]}", >>>>>> :action => :remove) %> >>>>>> >>>>>> Thanks, >>>>>> Tom >>>>>> >>>>>> On 10/18/05, Francois Paul <francois-VKbYeNyhmt9BDgjK7y7TUQ@public.gmane.org> wrote: >>>>>> >>>>>> >>>>>> could you post the relevant piece of code in you view? >>>>>> >>>>>> >>>>>> Tom Davies wrote: >>>>>> >>>>>> >>>>>> >>>>>> Hi, >>>>>> >>>>>> I am trying to apply multiple statements in a :complete for a >>>>>> link_to_remote. The first statement performs the visual effect >>>>>> drop >>>>>> out. The second statement, removes that element using >>>>>> update_element_function :action => :remove. >>>>>> >>>>>> When both statements are present, the drop out effect does not >>>>>> work. >>>>>> Both statements work independently. There are no javascript >>>>>> errors. >>>>>> >>>>>> I believe this may be due to how the browser renders javascript >>>>>> statements. It seems that all javascript within a :complete >>>>>> tag is >>>>>> rendered simultaneously. So, the drop out does not show >>>>>> because the >>>>>> element is already removed. Can anyone verify this? Is there a >>>>>> workaround? >>>>>> >>>>>> Thanks, >>>>>> Tom >>>>>> _______________________________________________ >>>>>> Rails mailing list >>>>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>>>> http://lists.rubyonrails.org/mailman/listinfo/rails >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> Rails mailing list >>>>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>>>> http://lists.rubyonrails.org/mailman/listinfo/rails >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> _______________________________________________ >>>>> Rails mailing list >>>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>>> http://lists.rubyonrails.org/mailman/listinfo/rails >>>>> >>>>> >>>>> >>>> _______________________________________________ >>>> Rails mailing list >>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>> http://lists.rubyonrails.org/mailman/listinfo/rails >>>> >>>> >>>> >>> _______________________________________________ >>> Rails mailing list >>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>> http://lists.rubyonrails.org/mailman/listinfo/rails >>> >>> >>> >> >> >> -- >> -Tout ce qui n''est pas donné est perdu - Hasari Pal >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
That is great information. Thanks a bunch. I did not expect to hear any more about this.... but the queue seems like a great addition. Much appreciated. Tom On 10/29/05, Thomas Fuchs <t.fuchs-moWQItti3gBl57MIdRCFDg@public.gmane.org> wrote:> The change (+test) is included with Rails changeset 2807: > http://dev.rubyonrails.com/changeset/2807 > > Cheers, > Thomas > > Am 29.10.2005 um 19:44 schrieb Thomas Fuchs: > > > Use the queue option on both effects (with Rails 0.14+), e.g. > > > > :oncomplete => visual_effect(:drop_out,"element_id",:queue => "''end''") > > > > (untested!) > > > > I''m working on a patch to get rid of the extra '' for the :queue > > option. > > > > This will make the effects queued up, so the second effect starts > > when the first effect finishes. > > > > Thomas > > > > Am 29.10.2005 um 19:25 schrieb Romuald du Song: > > > > > >> I had the same kind of synchronisation problem using two visual > >> effects, one on loading, > >> the other one on complete. > >> I manage to synchronize somehow the effects by calling the cancel > >> method on first effect > >> before starting the second. I saw there was also callbacks on effect, > >> so you could > >> use ''afterFinish'' to synchronize yours. > >> > >> Rom > >> > >> 2005/10/18, Tom Davies <atomgiant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > >> > >> > >>> Hi Jaap, > >>> > >>> I could do that, but I am not sure it would behave differently. Both > >>> statements are executing now, but the problem is that they seem > >>> to be > >>> executing simultaneously. > >>> > >>> Actually, I think I just determined the root of the problem. The > >>> drop_out effect takes place over some interval of time. As soon as > >>> the drop_out is started, the evaluate_remote_response removes the > >>> element that is dropping out before it can finish dropping out. > >>> Perhaps what I am after is a delay before the > >>> evaluate_remote_response, to allow enough time for the drop out to > >>> finish. > >>> > >>> So, my new question is: Is this delay functionality a part of RoR''s > >>> AJAX support? > >>> > >>> I suppose I could write my own delay function as well, but I don''t > >>> want to re-invent the wheel. > >>> > >>> Alternatively, I think I could save myself a lot of grief by > >>> handling > >>> deleted elements gracefully on the server-side, and not actually > >>> deleting the element on the client side. > >>> > >>> Tom > >>> > >>> On 10/18/05, Jaap Schreurs <jhschreurs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >>> > >>> > >>>> Tom, > >>>> > >>>> Can''t you put the :complete statements in a separate javascript > >>>> function, which you call in the :complete statement? > >>>> > >>>> Jaap > >>>> > >>>> On 10/18/05, Tom Davies <atomgiant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >>>> > >>>> > >>>>> Hi Francois, > >>>>> > >>>>> Thanks for your response. However, the visual effect was already > >>>>> adding the semi-colon. I tried adding an extra one, but no luck. > >>>>> > >>>>> In case it helps, here is the actual onComplete javascript that > >>>>> gets generated: > >>>>> > >>>>> onComplete:function(request){new > >>>>> Effect.DropOut(''gift_1'',{});eval(request.responseText)} > >>>>> > >>>>> > >>>>> Tom > >>>>> > >>>>> On 10/18/05, Francois Paul <francois-VKbYeNyhmt9BDgjK7y7TUQ@public.gmane.org> wrote: > >>>>> > >>>>> > >>>>>>> :complete => > >>>>>>> > >>>>>>> > >>>>>> [visual_effect(:drop_out,"gift_#{gift.id}"), > >>>>>> evaluate_remote_response]}, > >>>>>> > >>>>>> as I understand it :complete renders javascript so you have > >>>>>> to seperate > >>>>>> your functions with an javascript end of command ( ; ). > >>>>>> > >>>>>> maybe try: > >>>>>> > >>>>>> :complete => visual_effect(:drop_out,"gift_#{gift.id}") + > >>>>>> ";" + evaluate_remote_response}, > >>>>>> > >>>>>> > >>>>>> no guarantee - not tested > >>>>>> > >>>>>> > >>>>>> > >>>>>> regards, > >>>>>> Francois > >>>>>> > >>>>>> > >>>>>> > >>>>>> Tom Davies wrote: > >>>>>> Sure. Here are some snippets of my code: > >>>>>> > >>>>>> In the main view (there is a link_to_remote for each gift_<id> > >>>>>> element): > >>>>>> > >>>>>> <%= link_to_remote "Delete", {:confirm => "Are you sure?", > >>>>>> :url => { :action => "delete_gift", :id => gift, :page => > >>>>>> @params[:page]}, > >>>>>> :complete => [visual_effect(:drop_out,"gift_#{gift.id}"), > >>>>>> evaluate_remote_response]}, > >>>>>> {:href => url_for(:action => "delete_gift", :id => gift, > >>>>>> :page => @params[:page])}%> > >>>>>> > >>>>>> In the remote response partial: > >>>>>> > >>>>>> <%= update_element_function( > >>>>>> "gift_#{@params[:id]}", > >>>>>> :action => :remove) %> > >>>>>> > >>>>>> Thanks, > >>>>>> Tom > >>>>>> > >>>>>> On 10/18/05, Francois Paul <francois-VKbYeNyhmt9BDgjK7y7TUQ@public.gmane.org> wrote: > >>>>>> > >>>>>> > >>>>>> could you post the relevant piece of code in you view? > >>>>>> > >>>>>> > >>>>>> Tom Davies wrote: > >>>>>> > >>>>>> > >>>>>> > >>>>>> Hi, > >>>>>> > >>>>>> I am trying to apply multiple statements in a :complete for a > >>>>>> link_to_remote. The first statement performs the visual effect > >>>>>> drop > >>>>>> out. The second statement, removes that element using > >>>>>> update_element_function :action => :remove. > >>>>>> > >>>>>> When both statements are present, the drop out effect does not > >>>>>> work. > >>>>>> Both statements work independently. There are no javascript > >>>>>> errors. > >>>>>> > >>>>>> I believe this may be due to how the browser renders javascript > >>>>>> statements. It seems that all javascript within a :complete > >>>>>> tag is > >>>>>> rendered simultaneously. So, the drop out does not show > >>>>>> because the > >>>>>> element is already removed. Can anyone verify this? Is there a > >>>>>> workaround? > >>>>>> > >>>>>> Thanks, > >>>>>> Tom > >>>>>> _______________________________________________ > >>>>>> Rails mailing list > >>>>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >>>>>> http://lists.rubyonrails.org/mailman/listinfo/rails > >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>>> _______________________________________________ > >>>>>> Rails mailing list > >>>>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >>>>>> http://lists.rubyonrails.org/mailman/listinfo/rails > >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>> _______________________________________________ > >>>>> Rails mailing list > >>>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >>>>> http://lists.rubyonrails.org/mailman/listinfo/rails > >>>>> > >>>>> > >>>>> > >>>> _______________________________________________ > >>>> Rails mailing list > >>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >>>> http://lists.rubyonrails.org/mailman/listinfo/rails > >>>> > >>>> > >>>> > >>> _______________________________________________ > >>> Rails mailing list > >>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >>> http://lists.rubyonrails.org/mailman/listinfo/rails > >>> > >>> > >>> > >> > >> > >> -- > >> -Tout ce qui n''est pas donné est perdu - Hasari Pal > >> _______________________________________________ > >> Rails mailing list > >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >> http://lists.rubyonrails.org/mailman/listinfo/rails > >> > >> > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >