【发布时间】:2014-01-14 01:42:31
【问题描述】:
我有 dataTables 在我的 rails 应用程序中处理表格,但在我安装引导程序并尝试使用引导程序设置表格后,表格不会切换到新样式。我按照“Twitter Bootstrap 3 安装”下的步骤进行操作:https://github.com/rweng/jquery-datatables-rails
不知道我做错了什么。这是我的代码:
视图中的表格:
<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>
Application.js
//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require dataTables/jquery.dataTables
//= require dataTables/jquery.dataTables.bootstrap3
//= require turbolinks
//= require_tree .
$(document).ready(function()
{
$("#products").dataTable({
sPaginationType: "bootstrap"
});
}
);
Application.css
/*
*= require_self
*= require dataTables/jquery.dataTables.bootstrap3
*= require_tree .
*/
我做错了什么?感谢您的帮助。
更新
我添加了 class="table table-bordered table-striped" 这有点帮助,但仍然没有完成这项工作。
【问题讨论】:
-
也许这个链接可以帮助你,如果没有,请在 github 上发帖到。 github.com/rweng/jquery-datatables-rails/issues/73
标签: jquery ruby-on-rails-4 datatables jquery-datatables twitter-bootstrap-rails