}
targets.fadeToggle(200);
});
+
$(document).
on('ajax:send', function(e, xhr) {
$('.loading').fadeTo('fast', 1);
parent().
find('>span').
append(new_tag_span).
- append(' ');
+ append(' ');
$.ajax($(this).attr('data-remote-href'),
{dataType: 'json',
type: $(this).attr('data-remote-method'),
});
HeaderRowFixer = function(selector) {
- var tables = $(selector);
this.duplicateTheadTr = function() {
- tables.each(function() {
+ $(selector).each(function() {
var the_table = this;
+ if ($('>tbody>tr:first>th', the_table).length > 0)
+ return;
$('>tbody', the_table).
prepend($('>thead>tr', the_table).
clone().
});
}
this.fixThead = function() {
- tables.each(function() {
+ $(selector).each(function() {
var widths = [];
- $('> tbody > tr:eq(0) > td', this).each( function(i,v){
+ $('> tbody > tr:eq(1) > td', this).each( function(i,v){
widths.push($(v).width());
});
for(i=0;i<widths.length;i++) {
});
}
}
+
var fixer = new HeaderRowFixer('.table-fixed-header-row');
- fixer.fixThead();
fixer.duplicateTheadTr();
+ fixer.fixThead();
$(window).resize(function(){
fixer.fixThead();
});
-})(jQuery);
+ $(document).on('ajax:complete', function(e, status) {
+ fixer.duplicateTheadTr();
+ fixer.fixThead();
+ });
+});