Question

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.

Was it helpful?

Solution 2

Using stickyTableHeaders JQuery plugin solved my problem.

https://github.com/jmosbech/StickyTableHeaders

OTHER TIPS

Your question does not have the details to properly analyse what is wrong. However, try these and see if it helps.

Does your application.js have require_tree in it? Also, try adding your my_js_coffee_file in the end of the application.js

Ex :

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

Or alternatively, you can also code the same thing inside the application.js file itself. And then try running. Check your console log to see what errors pop up.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top