javascriptjqueryruby-on-railstwitter-bootstraptableheader

rails fixed header table with varied width


I'm trying to create a fixed header table in my index view. After 2 days I'm on it, I finally found the jQuery fixedheadertable addon, and I still can't use it. I guess I'm doing something wrong because it's the first time I'm using jQuery. This is what I have done:

Added the file jquery.fixedheadertable.js to \app\assets\javascripts

In application.js:

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

In my_js_coffee_file:

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

Also tried:

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

No change at all... what's wrong here?

Thanks.


Solution

  • Using stickyTableHeaders JQuery plugin solved my problem.

    https://github.com/jmosbech/StickyTableHeaders