Table filter

Bonjour,I'd like to filter the following table

  <th><a href=#>Nom salle</a></th>
  <th><a href=#>Nom machine</a></th>
  <th><a href=#>Type d'incident</a></th>
  <th><a href=#>Informations</a></th>
  <th id="etat"><a href=#>Etat</a></th>
  <th><a href=#>Date création</a></th>
  <th><a href=#>Date résolution</a></th>
  <th><a href=#>Actions</a></th>
<% @events.each do |event| %>
  <% # change background for event updated less than 3 minutes ago
  if 3.minutes.ago.to_formatted_s(:db) < event.date_resolution
    tr_class = ' class="bg_orange"'
    tr_class = ''
  <tr<%= tr_class %>>
  <td><%=h event.room_name %></td>
  <td><%=h event.computer_name %></td>
  <td><%=h event.type_event %></td>
  <td><%=h event.event_info %></td>
  <td><% if event.state_event=="1" %><%=h "non résolu" %> <% else
%><%=h "résolu" %> <% end %></td>
  <td><%=h event.date_creation %></td>
  <td><% if event.state_event=="1" %><%=h "non résolu" %> <% else
%><%=h event.date_resolution %><% end %></td>
    <%= link_to image_tag("icons/zoom.png", :title=>"Afficher") ,
url_for(:controller => "events", :action => "show", :id =>
event.event_id) %>
    <% if current_user %>
      <%= link_to image_tag("icons/edit.png", :title=>"Modifier") ,
url_for(:controller => 'events', :action => 'edit', :id =>
event.event_id) %>
      <%= link_to image_tag("icons/delete.png", :title=>"Modifier"), {
:action => "destroy", :id => event.event_id}, :confirm => 'Are you
sure?', :method => :delete, :form_class=> "toto" %>
    <% end %>
<% end %>

The "Etat" row contains on each line one of the three following value :
"Avertissement", "Information", "Urgent".

I want to used 3 radio buttons (named "Avertissement",
"Information", "Urgent"). While one of the buttons is clicked, the table
only displays the matching lines. For example,
if the "Urgent" button is clicked, the table will only display the lines
with the "Urgent" cell on it. Can anyone help me ?

Sounds like a job for JavaScript adding and removing visibility on the
items, possibly via setting whether CSS says their particular classes
are visible or not. Also I'd recommend an "All" option.


I agree with Dave - this is probably the easiest way to do it.

However, if your requirements to this table are expected to grow (like
Sorting, filtering on arbitrary content, row-selections etc.) you may
want to take a look into DataTables( . I'm
using for almost all of my tabular data, as it gives you so much
functionality for free and is painless to integrate (Although it may
be a terrible overkill in your case right now...)