データテーブルのフロントページにあるように、素敵なjquery-uiとともに、データテーブルを美しく実行しました。
ただし、私が抱えている主な問題は、CoffeeScript/JS が苦手なことです。
1秒ごとにデータテーブルをリロードしようとしていますが、Webサーバーにリクエストが送信されないため、Webページ自体が更新されません。
これが私のコードです:
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);
fnDraw でテーブルを再描画するために setInterval コールバックが実行されていないようです。
setInterval コーディングが間違っているようです。
これが私の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 %>
助けていただければ幸いです。