Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery Tablesorter in ruby on rails
    primarykey
    data
    text
    <p>I'm using Ruby on Rails and have a table that I am trying to sort. The tablesorter jquery plugin and it is properly loaded in my files. I have jquery called in front of it at well. I have this code in my javascript. </p> <pre><code>$(document).ready(function(){ $("#myTable").tablesorter({widgets: ['zebra']}); $("#business").tablesorter({sortList: [[0,0], [1,0]]}); }); </code></pre> <p>I have 2 tables. I have my table which is static just to see if the code was working right (and it does). I can sort by clicking on any of the headers.</p> <pre><code>&lt;table id="myTable"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Last Name&lt;/th&gt; &lt;th&gt;First Name&lt;/th&gt; &lt;th&gt;Email&lt;/th&gt; &lt;th&gt;Due&lt;/th&gt; &lt;th&gt;Web Site&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;Smith&lt;/td&gt; &lt;td&gt;John&lt;/td&gt; &lt;td&gt;jsmith@gmail.com&lt;/td&gt; &lt;td&gt;$50.00&lt;/td&gt; &lt;td&gt;http://www.jsmith.com&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Bach&lt;/td&gt; &lt;td&gt;Frank&lt;/td&gt; &lt;td&gt;fbach@yahoo.com&lt;/td&gt; &lt;td&gt;$50.00&lt;/td&gt; &lt;td&gt;http://www.frank.com&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Doe&lt;/td&gt; &lt;td&gt;Jason&lt;/td&gt; &lt;td&gt;jdoe@hotmail.com&lt;/td&gt; &lt;td&gt;$100.00&lt;/td&gt; &lt;td&gt;http://www.jdoe.com&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Conway&lt;/td&gt; &lt;td&gt;Tim&lt;/td&gt; &lt;td&gt;tconway@earthlink.net&lt;/td&gt; &lt;td&gt;$50.00&lt;/td&gt; &lt;td&gt;http://www.timconway.com&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>But I also have my other table which is pulling dynamically from a database. Which doesn't work at all and does nothing at all when I click on the headers. </p> <pre><code>&lt;table width="650" cellpadding="6" cellspacing="0" id="business"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Business Name&lt;/th&gt; &lt;th&gt;Address&lt;/th&gt; &lt;th&gt;Category&lt;/th&gt; &lt;th&gt;Description&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;% @businesses.each do |business|if !business.approved %&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;&lt;a class="Contact&lt;%=h business.id %&gt;" href="#"&gt;&lt;%=h business.name %&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;%=h business.address %&gt;&lt;/td&gt; &lt;td&gt;&lt;%=h business.business_category.name %&gt;&lt;/td&gt; &lt;td&gt;&lt;%=h business.description %&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;% end %&gt; &lt;/table&gt; </code></pre> <p>Any help would be great.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload