Sort & scrollable table

So I have a show.rhtml that displays XML data generated from perl. The
column headers are the element tags in the XML, enclosing the data. I
have two questions

  1. How would I make the columns sortable when a user clicks on the
    column header; ASC/DESC?

  2. How would you create a text box that would allow me to filter the
    results? For instance, if a column was labeled “State”, I could switch
    the filter to state, and Just type a “T”, and only rows with a state
    starting with a T would be displayed.

Is there a plugin or an easy way to do these two things?

Here is my table ion the show.rhtml

<thead>
  <tr>

<%
link_index = nil
@report.columns.each do |col|
if(col.name.downcase == ‘link’ || col.name.downcase == ‘label’)
link_index = col.name

-%>


<%
else
-%>

<%
end
end
-%>



<%= ‘

Sorry, no results were found with the
supplied parameters

’ if @report.rows.size == 0 %>
<%
@report.rows.each do |row|
if link_index
-%>
<tr class=“clickable <%= cycle(”", “shade”) -%>"
onclick=“window.location=’<%= url_for :action => ‘drill_down’, :params
=> { :url => CGI.escape(row[link_index])} %>’”>
<%
else
-%>
<tr class="<%= cycle("", “shade”) -%>">
<%
end
@report.columns.each do |col|
if (col.name != link_index)
-%>

<%
else
-%>

<%
end
end
-%>

<%
end
-%>
Drill Down Avail <%= col.human_name %>
<%= row[col.name] %> <%= link_to ‘+’, :action => ‘drill_down’, :params => { :url
=> CGI.escape(row[link_index])} %>

will_paginate MAY do what I need, but I am not reading from a table. I
do a call to a perl script which returns an XML stream/response that
ruby catches.

the examples I am seeing is reading from a table. How would I do set
this up when the data is coming from an XML stream and not a database?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs