Found an even better way to do it! It's in the readme for the jquery-datatables-rails gem:
Twitter Bootstrap 2 support
Add the JavaScript to application.js:
//= require dataTables/jquery.dataTables.bootstrap
Remove the initial stylesheets from application.css
Add the stylesheets to application.css:
*= require dataTables/jquery.dataTables.bootstrap
Initialize your datatables like this:
// For fluid containers
$('.datatable').dataTable({
"sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
"sPaginationType": "bootstrap"
});
Just a tip -- don't put it in your assets group in the gemfile or it won't work on production when deploying to Heroku.
Found an even better way to do it! It's in the readme for the jquery-datatables-rails gem:
Twitter Bootstrap 2 support
Add the JavaScript to application.js:
//= require dataTables/jquery.dataTables.bootstrap
Remove the initial stylesheets from application.css
Add the stylesheets to application.css:
*= require dataTables/jquery.dataTables.bootstrap
Initialize your datatables like this:
// For fluid containers
$('.datatable').dataTable({
"sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
"sPaginationType": "bootstrap"
});
// For fixed width containers
$('.datatable').dataTable({
"sDom": "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>",
"sPaginationType": "bootstrap"
});
https://github.com/rweng/jquery-datatables-rails
+1