Reputation: 1098
I'm trying to apply bootstrap3 styling to my rails application, but I'm having some trouble with the DataTables styling. I know this is kind of a recurring question, but I haven't found a solution on any of them.
This is the relevant part of my .gemfile:
gem 'haml'
gem 'jquery-datatables-rails', git: 'https://github.com/rweng/jquery-datatables- rails.git'
gem 'jquery-ui-rails'
gem 'highcharts-rails'
gem 'therubyracer'
gem 'less-rails'
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git', :branch => 'bootstrap3'
This is my application.js:
// require turbolinks
//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
// require jquery.turbolinks
// require_tree .
//= require dataTables/jquery.dataTables
//= require dataTables/jquery.dataTables.bootstrap3
//= require jquery.ui.core
Note that I have both require_tree and turbolinks disabled.
This is my application.css:
*= require_self
*= require jquery.ui.core
*= require jquery.ui.theme
*= require_tree .
*= require dataTables/jquery.dataTables.bootstrap3
*= require special
The last line, 'require special', is for certain overrides I use on my website. They're not related to anything on DataTables, but to make sure, the file is currently empty.
My js.coffee table has this:
jQuery ->
$('#d_table').dataTable
sPaginationType: "bootstrap"
Nothing special, it's just the initialization for the table.
And I get this:
What am I missing?
EDIT:
In case you're wondering, this is the code that generated that table (in HAML):
%table#d_table
%thead
%tr
%th='Field1'
%th='Field2'
%th='Field3'
%th='Field4'
%th='Field5'
%tbody
- (1..70).each do
%tr
- (1..5).each do |a|
%td="This is #{a}"
Upvotes: 2
Views: 6131
Reputation: 3329
In bootstrap a table inherits all of its styles from the .table
class.
Try adding the class .table
to the table element.
Upvotes: 7