I got datatables up and running, beautifully along with the nice jquery-ui as in the front page of datatables.
However, the main issue I'm having though is that I suck at CoffeeScript/JS
I'm trying to reload datatables every 1 second but don’t see any request coming into the webserver and hence no refreshes on the web page itself.
Here's my code:
app/assets/javascripts/comments.js.coffee
jQuery ->
$('#comments_id').dataTable
sPaginationType: "full_numbers"
bJQueryUI: true
bProcessing: true
sAjaxSource: $('#coments')
setInterval('$("#comments_id").dataTable().fnReloadAjax()', 3000);
It appears the setInterval callback is not being executred to redraw the table with fnDraw.
It seems I have the setInterval coding wrong.
Here is my the code in my app/view/comments/index.html.erb
<h1>Listing comments</h1>
<table id="comments_id" class="display">
<thead>
<tr>
<th>String</th>
</tr>
</thead>
<% @comments.each do |comment| %>
<tbody>
<tr>
<td><%= comment.string %></td>
</tr>
<% end %>
</tbody>
</table>
<br />
<%= link_to 'New Comment', new_comment_path %>
Help will be appreciated.