Making a row a link?

Not sure to understand what you mean but something like <tr><%=
link_to "your_link" ... %></tr>

Tranquiliste wrote:

Not sure to understand what you mean but something like <tr><%=
link_to "your_link" ... %></tr>

On Jul 13, 11:29 pm, Justin To <rails-mailing-l...@andreas-s.net>

<tr onclick="location.href='<%= %>'" >

I want the actual row to be clickable... but how do I invoke an action
when on the onclick??

Thanks

Justin To wrote:

Tranquiliste wrote:

Not sure to understand what you mean but something like <tr><%=
link_to "your_link" ... %></tr>

On Jul 13, 11:29 pm, Justin To <rails-mailing-l...@andreas-s.net>

<tr onclick="location.href='<%= %>'" >

I want the actual row to be clickable... but how do I invoke an action
when on the onclick??

Thanks

I need something like this: <tr onclick="invoke controller action">

Thanks

Justin To wrote:

Justin To wrote:

Tranquiliste wrote:

Not sure to understand what you mean but something like <tr><%=
link_to "your_link" ... %></tr>

On Jul 13, 11:29 pm, Justin To <rails-mailing-l...@andreas-s.net>

<tr onclick="location.href='<%= %>'" >

I want the actual row to be clickable... but how do I invoke an action
when on the onclick??

Thanks

I need something like this: <tr onclick="invoke controller action">

Thanks

This should work :

<tr onclick="<%= remote_function :url=>{:action=>:my_action} %>">

how obtrusive :stuck_out_tongue:

nico Itkin wrote:

This should work :

<tr onclick="<%= remote_function :url=>{:action=>:my_action} %>">

Works great, but now I'm having trouble with the controller. In a
partial, I'm trying to replace_html with another partial...

So I've got this in the first partial:
<% for user in @users %>
.
.
.
<%= remote_function :url=>{:action=>:show_user_detail, :id => user.email
} %>
.
.
.
<div id="<%= user.email %>" style="display:none;">
    <tr class="row-details">
       <td>
         sdf
       </td>
     </tr>
</div>
This has some problems. Firstly, It still displays 'sdf' even though I
have display:none for the <div>, so what's wrong with that?

In my controller, I have this:

  def show_user_detail
    if(request.xhr?)
      render :update do |rjs|
        # :params[:id] ??? I've no clue if I did that right.
          rjs.replace_html :params[:id], :partial => 'form'
        end
    else
      redirect_to_index
    end
  end

Thanks for the help!

nico Itkin wrote:

This should work :

<tr onclick="<%= remote_function :url=>{:action=>:my_action} %>">

Works great, but now I'm having trouble with the controller. In a
partial, I'm trying to replace_html with another partial...

So I've got this in the first partial:
<% for user in @users %>
.
<%= remote_function :url=>{:action=>:show_user_detail, :id => user.email
} %>
.

<div id="<%= user.email %>" style="display:none;">

You can't have a div at the top level of a table like that. (in addition you can't use characters like @ in dom ids)

     render :update do |rjs|
       # :params[:id] ??? I've no clue if I did that right.
         rjs.replace_html :params[:id], :partial => 'form'

That should be params[:id]

Fred