Making <tr> a link_to?

Hi, wondering how I could make a <tr> call an action or something like that =)

Thanks

Hi, wondering how I could make a <tr> call an action or something like that =)

....<tr onclick="do some javascript here">....

I don't recall exactly if there are any issues with browsers not passing that click up from <td>'s or not, but that should get you started.

maybe

<% content_tag :a, :href => "#", :onclick => your_action do %>     <tr><td>hi</td><td>there</td><tr> <% end %>

<tr onclick="location.href='<%= blog_path(blog) %>'>

Hey, thanks for the help. I managed to get it to work with your guys' help, but now I'm not sure how to make it a link_to_remote. Thanks!

Justin To wrote:

Hey, thanks for the help. I managed to get it to work with your guys' help, but now I'm not sure how to make it a link_to_remote. Thanks!

Just to clarify, link_to and link_to_remote are view helper functions that generate <a> tags in your page, and the only different is that link_to_remote writes in javascript that will generate an AJAX request to the server instead of a traditional GET request. If you want a helper method to generate table rows that execute an AJAX request when clicked, you'll have to write it yourself.