Reputation: 871
I've followed along with the following tutorials to get DataTables setup in my Rails app, but I am seeing no change. Here's what I followed:
https://github.com/rweng/jquery-datatables-rails
http://railscasts.com/episodes/340-datatables
I am not getting an error. I'm just seeing no change. And I restarted my server.
Application.js
//= require dataTables/jquery.dataTables
Application.css
*= require dataTables/jquery.dataTables
View:
<table id="products">
<thead>
<tr>
<th>Name</th>
<th>Price</th>
</tr>
</thead>
<tbody>
<tr>
<td>Something</td>
<td>Something</td>
</tr>
<tr>
<td>Something</td>
<td>Something</td>
</tr>
<tr>
<td>Something</td>
<td>Something</td>
</tr>
</tbody>
</table>
Products.js.coffee
jQuery ->
$('#products').dataTable
I just want to be able to sort columns. Why is this not working?
Upvotes: 0
Views: 95
Reputation: 4586
Try converting Products.js.coffee back to regular javascript and seeing if the results are the same. If so, the problem is either with the javascript itself or the compilation of the coffeescript (make sure the coffee-rails gem is in the Gemfile). Also check out the RailsCast Coffeescript Episode.
Upvotes: 1