Raghav endiran
2009-Sep-11 09:53 UTC
TableSort JQuery not working with dynamic Rails Table
Dear All,
I am trying to use Table sort Jquery plugin to sort my table in
Rails application by clicking Table header. But it is not working.I added
<%= javascript_include_tag ''jquery.js''%>
<%= javascript_include_tag ''jquery.tablesorter.js''%>
in my layout...
Here is my Code,
<script>
jQuery(document).ready(function($){
$(".tablesorter").tablesorter({
widgets: [''zebra'']
});
});
</script>
<h1>Listing books</h1>
<table cellpadding="0" cellspacing="0"
class="tablesorter">
<thead>
<tr>
<th>
Title
</th>
<th>
Author
</th>
</tr>
</thead>
<% @books.each do |book| %>
<tbody>
<tr>
<td>
<%=h book.title %>
</td>
<td>
<%=h book.author %>
</td>
</tr>
</tbody>
<% end %>
</table>
<br/>
<%= link_to ''New book'', new_book_path %>
Help me pals...
--
Regards,
Raghavendiran J M
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Abhinav Saxena
2009-Sep-11 18:44 UTC
Re: TableSort JQuery not working with dynamic Rails Table
Move <tbody> </tbody> outside loop, and then check. -- अभिनव http://twitter.com/abhinav On Fri, Sep 11, 2009 at 3:23 PM, Raghav endiran <raghavanjm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> Dear All, > I am trying to use Table sort Jquery plugin to sort my table in > Rails application by clicking Table header. But it is not working.I added > <%= javascript_include_tag ''jquery.js''%> > <%= javascript_include_tag ''jquery.tablesorter.js''%> in my layout... > > Here is my Code, > > > <script> > jQuery(document).ready(function($){ > $(".tablesorter").tablesorter({ > widgets: [''zebra''] > }); > }); > </script> > > <h1>Listing books</h1> > <table cellpadding="0" cellspacing="0" class="tablesorter"> > <thead> > <tr> > <th> > Title > </th> > <th> > Author > </th> > </tr> > </thead> > > <% @books.each do |book| %> > <tbody> > <tr> > <td> > <%=h book.title %> > </td> > <td> > <%=h book.author %> > </td> > </tr> > </tbody> > <% end %> > </table> > <br/> > <%= link_to ''New book'', new_book_path %> > > Help me pals... > > -- > Regards, > Raghavendiran J M > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---