铁轨固定头台,宽度不一

时间:2014-07-29 10:09:27

标签: javascript jquery ruby-on-rails twitter-bootstrap tableheader

我正在尝试在索引视图中创建一个固定的标头表。 2天后,我终于找到了jQuery fixedheadertable插件,我仍然无法使用它。我想我做错了,因为这是我第一次使用jQuery。这就是我所做的:

将文件jquery.fixedheadertable.js添加到\app\assets\javascripts

application.js

//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require jquery.fixedheadertable
..
..

my_js_coffee_file

$ -> 
    $("#id_of_my_index_table").fixheadertable({
             caption : 'My header is fixed !',
             height  : 200
    });

也尝试过:

$ ->
  $('#id_of_my_index_table').fixedHeaderTable('show');

完全没有变化...... 这有什么不对?

感谢。

2 个答案:

答案 0 :(得分:0)

您的问题没有正确分析错误的详细信息。但是,试试这些并看看它是否有帮助。

你的application.js中是否有require_tree?另外,尝试在application.js

的末尾添加my_js_coffee_file

前:

//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require jquery.fixedheadertable
//= require my_js_coffee_file

或者,您也可以在application.js文件本身内编码相同的内容。然后尝试跑步。检查控制台日志以查看弹出的错误。

答案 1 :(得分:0)

使用stickyTableHeaders JQuery插件解决了我的问题。

https://github.com/jmosbech/StickyTableHeaders

相关问题