DataTables / FixedHeader

Fix the header, footer, left or right columns of a table in place, to always show them when scrolling
http://www.datatables.net/
Other
75 stars 83 forks source link

Fix proposal for: DataTables with column widths defined in % loose the % and don't resize correctly #33 #34

Open xmojmr opened 10 years ago

DataTables commented 10 years ago

In the past I've found that using percentage is very unreliable when syncing column sizes between different tables and in different browsers as is required here. I've only been successful with pixels and even then there are loads of things that can go wrong! I'll try your patch when I get a bit of time and see how it handles it :-). Thanks for the patch.

xmojmr commented 10 years ago

Converting everything into pixels

  1. does not work when the table is not visible. In invisible mode $().width() does not return correct pixel value but rather required percent value. So the conversion code translates 20% into 20px which is not correct
  2. it effectively disables scalabilty. Resizing/rotating just does not work as original scalable units are lost

I have fixed just the header part and just for the case that I need, widths defined in code through the columns.width, table width defined in %

Another thing that is not resolved very well is that the temporary hiding/showing which is necessary for reading correct original % values does not restore screen focus/scrollbars correctly

I have filed the "patch" rather than just creating a complaining issue. The pile of opened issues is quite long already and the chance you'd jump and fix my problems did not seem very likely :)

DataTables commented 10 years ago

DataTables has a columns.adjust() method for use when a hidden table is made visible to have the column sizes adjust automatically. It also has built in options for handling resizing windows.

If % widths can be made to work with pixel perfect accuracy, then that is absolutely the way forward, I just haven't been able god make it do so way. As I say, I'll try you patch out when I get a chance as see if it resolves that issue :-)

xmojmr commented 10 years ago

Finally I overcame the sizing problems by using another jQuery plugin https://github.com/jmosbech/StickyTableHeaders which seems to do it correctly and has better open_issues/closed_issues ratio.

So far I'm not experiencing any problems with that plugin. So instead of accepting my pull request it might be more benefitial for the FixedHeader plugin if it would merge whole code base from the StickyTableHeaders and just keep the public interface