I was looking for a way to make table row clickable.
I found answer here, but it has one quite bad bug. It only lets you open link once. Even if you're redirected, and then you press "back" button, you can't click again.
I personally would put an
onclick
event on thetr
using jQuery. Thetr
element would look like this:<tr data-link="<%= edit_scout_path(scout) %>"> ... </tr>
And then the associated JavaScript (placed in a file such as
app/assets/javascripts/scouts.js
) would be something like this:$("tr[data-link]").click(function() { window.location = this.data("link") })
This would make all
tr
elements that have adata-link
attribute act as if they were URLs in the most unobtrusive way I can think possible.
Only thing that makes it work again is refreshing site, which is really frustrating.
Do you know how may I fix this issue?