Alain Ravet
2006-Apr-26 06:46 UTC
[Rails] RJS and Greybox : executing the js in the parent window?
Hi all, Question: Can a child window manipulate its parent window with RJS? Example: In an application a parent/master window shows a list of records. When the users press ''edit'', a greybox windows pops up where they can update one item attributes. Problem: after the ''save'' and child window closing, the parent window still contains the old attributes values. I know how to trigger plain javascript execution in the parent, to clean the parent window f.ex, but RJS is really what I need. Is that possible? TIA Alain -- Posted via http://www.ruby-forum.com/.
Alain Ravet
2006-Apr-26 12:30 UTC
[Rails] RJS and Greybox : executing the js in the parent window?
> Question:> Can a child window manipulate its parent window with RJS? As a workaround, I have the children execute some javascript code that in turn has the parent execute some javascript code where I inserted an Ajax call to a controller action that refreshes the parent contents. => when the user submit the action in the child/greybox window, it calls an action : file:contact_controller.rb def update ... render :partial => ''hide_greybox_and_refresh_details_in_parent'' ... end file: _hide_greybox_and_refresh_details_in_parent.rhtml: <script type="text/javascript"> parent.GB_hide(); parent.refresh_contact_details(); </script> , and the parent page html starts with: <script type="text/javascript"> function refresh_contact_details(){ new Ajax.Request(''/gids/display_entity_details/''+<%@contact.id %>, {asynchronous:true, evalScripts:true}); } </script> My question: is there a way to execute one single RJS call in the ''update'' function above, that would do the same as this 3-part action?
Franco Sellitto
2008-Apr-04 16:17 UTC
Re: RJS and Greybox : executing the js in the parent window?
Hello Alain I''m right looking to obtain the same behavior. In the meantime, did you found a solution with RJS? Thanks, Franco -- 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 -~----------~----~----~----~------~----~------~--~---