I would like to have a “Print” link which when clicked, calls my
print_list method to populate the print_list view, then opens the
print_list view in a NEW browser window. I’m using Firefox 1.5.0.9.
So far I have:
<%= link_to “Print”, :action => ‘print_list’, :popup => true %>
This partially works - it calls the print_list method which properly
generates and populates the view. However, I can’t get it to come up in
a NEW window instead of overlaying my current window. I’ve tried
various permutations of braces and using variables instead of “true”.
Here’s another example of what I’ve been trying:
I tried your permutation and the results are no different. It displays
the print_list view in the same browser tab, overwriting the original
page. I want the original page to remain and the printable page to come
up in a new browser window.
By the way, my action doesn’t usea specific id - it’s just a list of the
entire table in the order the user has picked.
Thanks, Kim. I tried fiddling with the Firefox settings and that made no
difference.
Other sites can open new windows from my browser so I know it can be
done, but they use non-Rails methodology for that aspect. For example,
the ZiYa plugin at http://liquidrail.com/ (recently announced on this
list) opens a new window when I click on a chart image. Also, Google
Docs and Spreadsheets at http://docs.google.com/ opens a new window to
print a document.
But I want to know how to do it within my Erb command so I don’t have to
revert to pure JavaScript or use some other package!
OK remove the id portion but I suspect that the reason that it isn’t
popping up a window for you is that you need the javascripts library and
thus need to include a layout that has <%=
javascript_include_tag :defaults %> in it.
Craig
I do have <%= javascript_include_tag :defaults %> in my
application.rhtml, and all the default js libs show up in the page
source code for my page.
I am also using rico.js. I tried removing that but it makes no
difference to the popup window.
I tried your permutation and the results are no different. It displays
the print_list view in the same browser tab, overwriting the original
page. I want the original page to remain and the printable page to come
up in a new browser window.
By the way, my action doesn’t usea specific id - it’s just a list of the
entire table in the order the user has picked.
OK remove the id portion but I suspect that the reason that it isn’t
popping up a window for you is that you need the javascripts library and
thus need to include a layout that has <%=
javascript_include_tag :defaults %> in it.
Craig
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.