我得到了数据表和精美的jquery-ui以及数据表的首页。jquery/rails回调一个函数来刷新数据表
不过,我有虽然主要问题是,我在CoffeeScript中/ JS吸
我试图重新载入数据表每1秒,但没有看到任何请求进入网络服务器,因此没有刷新网页本身。
这里是我的代码:
应用程序/资产/ Java脚本/ comments.js.coffee
jQuery ->
$('#comments_id').dataTable
sPaginationType: "full_numbers"
bJQueryUI: true
bProcessing: true
sAjaxSource: $('#coments')
setInterval('$("#comments_id").dataTable().fnReloadAjax()', 3000);
它出现的setInterval回调不被executred重绘表fnDraw。
看来我的setInterval编码错了。
这是我在我的应用程序/浏览/评论/ 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 %>
帮助将不胜感激。