When I''m in a controller and view A, and there bring up a layer with an id to list items from another controller B using AJAX (link_to_remote), how do I deal with that? I get an error with pure javascript on the page when clicking on the next button in the paginate nav bar. When hover over the next-link looking at the url it points at the controller B, obviously. But how do I stay in the current controller/view? I hope you understand my problem. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Pål Bergström wrote:> When I''m in a controller and view A, and there bring up a layer with an > id to list items from another controller B using AJAX (link_to_remote), > how do I deal with that? I get an error with pure javascript on the page > when clicking on the next button in the paginate nav bar. When hover > over the next-link looking at the url it points at the controller B, > obviously. But how do I stay in the current controller/view? I hope you > understand my problem.Anyone? Is it possible to use a method containing the pagination-search from another controller but stay in the current view/controller? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Sorry, I don''t understand your problem. You have a link to some ajax action. You click it and get the ajax response. What would you mean with "stay in the current controller"? After all html is a state less protocol and you''re never "in" a specific controller. Though the navbar may tell you where the actual page came from, but an ajax call doesn''t change that. And what exactly should "I get an error with pure javascript on the page when clicking on the next button...". So this error is your problem? Then it would help tremendously if you would post that error. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thorsten Mueller wrote:> Sorry, I don''t understand your problem. > You have a link to some ajax action. You click it and > get the ajax response. What would you mean with > "stay in the current controller"? After all html is a state less > protocol and you''re never "in" a specific controller. Though > the navbar may tell you where the actual page came from, but > an ajax call doesn''t change that. > And what exactly should "I get an error with pure javascript on the > page > when clicking on the next button...". So this error is your problem? > Then it would help tremendously if you would post that error.I''m in a controller/view ''intranet''. There I have a <%= link_to_remote "List Comments", :url => {:controller => ''messages'', :action => ''comments'', :id => message }, :html => { :style => ''''} , :loading => "Element.show(''timeloop'')", :complete => "Element.hide(''timeloop'')" %> This opens a div in ''intranet'' <div id="commentlist"> <%= render :partial => ''messages/commentlist'' %> </div> with this in messages_controller def comments @comments = Comment.paginate :per_page => session[:comments_listnr], :page => params[:comments], :conditions => ["message_id = ?", params[:id]] session[:message_id] = params[:id] render :update do |page| page.show ''editarearight'' page.replace_html ''editarearight'', :partial => ''messages/comments'' end end The list comes up and the navigation from paginations comes up fine. But when clicking the navigation I get an page with just text, javascript code. This is my navigation/pagination <%= will_paginate @comments, :param_name => ''comments'', :remote => { :with => ''value'', :update => "commentlist"}, :prev_label => ''<'', :next_label => ''>'' %> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> <div id="commentlist"> > > <%= render :partial => ''messages/commentlist'' %> > > </div> > > with this in messages_controller > > def comments > @comments = Comment.paginate :per_page => session[:comments_listnr], > :page => params[:comments], :conditions => ["message_id = ?", > params[:id]] > session[:message_id] = params[:id] > render :update do |page| > page.show ''editarearight'' > page.replace_html ''editarearight'', :partial => ''messages/comments'' > end > end > > The list comes up and the navigation from paginations comes up fine. But > when clicking the navigation I get an page with just text, javascript > code. > > This is my navigation/pagination > > <%= will_paginate @comments, :param_name => ''comments'', :remote => { > :with => ''value'', :update => "commentlist"}, :prev_label => ''<'', > :next_label => ''>'' %> >ok, that''s an easy one. you can use link_to_remote (and all related ajax link generating helpers) in two ways: with the :update option or without. if you use it, as you do with :update => "commentlist", then it expects pure html as response and will try to update the named element, "commentlist" in that case. So it interprets your response as HTML. remove the :update thing, you tell it with page.replace_html "editarearight" that you want to replace another element anyway. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thorsten Mueller wrote: t''s an easy one.> > you can use link_to_remote (and all related ajax link generating > helpers) > in two ways: > with the :update option or without. > > if you use it, as you do with :update => "commentlist", then > it expects pure html as response and will try to update the named > element, "commentlist" in that case. > So it interprets your response as HTML. > remove the :update thing, you tell it with > page.replace_html "editarearight" > that you want to replace another element anyway.Thanks :-) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---