markmalek / Fixed-Header-Table

jQuery plugin for tables with fixed headers
www.fixedheadertable.com
MIT License
930 stars 541 forks source link

Fixedheadertable destroy cleanup not complete when using fixedColumns #133

Open hiparcos opened 9 years ago

hiparcos commented 9 years ago

I am using fixedheadertable plugin with 2 fixed columns and autoresize set to true. At first loading, the table is displayed correctly. Now for my table to resize automatically, I added a jquery resize event that destroy and reapply the plugin: $( window ).resize(function() { $('#myTable').fixedHeaderTable('destroy'); $('#myTable').fixedHeaderTable({ altClass: 'odd', footer: false, fixedColumns: 2, autoResize:true }); });

This works fine in Chrome and IE10+, but in firefox, the table rows height and width increase at each resize event. If I disable the fixedColumn functionality, the problem disappear.

It seems to have something to do with the destroy function not removing the width and height put in the markup of each row of the body, but I am not sure, and I don't know what's best to remove these attributes because jQuery is new to me.

Any idea how to solve this issue ?

hiparcos commented 9 years ago

I found the reason: it comes from the _fixHeightWithCss and _fixWidthWithCss functions that add the tableProps.border again and again at each resize. If I remove the border size adding it works. But I may face other issues removing this. If you have a better solution...