大佬教程收集整理的这篇文章主要介绍了ruby-on-rails – 将Rails 3.1与DataTables一起使用,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
把这一行放在你的gemfile中:
gem 'jquery-datatables-rails',github: 'rweng/jquery-datatables-rails'
并运行:
bundle install
另外,请确保将此行放在application.rb中:
config.assets.initialize_on_precompile = false
将其添加到您的application.js
//= require dataTables/jquery.dataTables
如果你使用bootstrap这一个:
//= require dataTables/jquery.dataTables.bootstrap
将其添加到您的application.css:
*= require dataTables/jquery.dataTables
或者如果你使用bootstrap这个:
*= require dataTables/jquery.dataTables.bootstrap
如果您使用bootstrap,请将此添加到您的控制器的js.coffee文件中,您使用的是数据表:
如果您使用的是流体容器:
#// For fluid containers $('#dashboard').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" });
以上是大佬教程为你收集整理的ruby-on-rails – 将Rails 3.1与DataTables一起使用全部内容,希望文章能够帮你解决ruby-on-rails – 将Rails 3.1与DataTables一起使用所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。