In my code Ive got an iteration, which outputs <tr>
elements with regarding content. Table elements in HTML are pretty limited so you cant wrap <a href="">
s around them. Insted there is a workaround in jquery/or whatever JS you are using like
$("tr[data-link]").on("click", function() {
window.location = $(this).parent().data("link");
});
which can be used to turn <tr>
into clickable elements which open up links. However this does not work for turbo frame links. If i use something like
<tr data-link="<%= project_path(@project) %>"
data-turbo-frame="project_sidebar">
...
it just opens up the link .. as expected, because window.location
does exactly this.
I tried stuff like Turbo.visit($(this).parent().data("link"));
in my js as well which don't work at all.
Is there a way to tell the <tr>
to open up a turbo frame via js instead of being a "real" link?