Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

xmojmr
Copy link

@xmojmr xmojmr commented May 18, 2014

No description provided.

@DataTables
Copy link
Collaborator

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
Copy link
Author

xmojmr commented May 18, 2014

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
Copy link
Collaborator

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
Copy link
Author

xmojmr commented Jun 2, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants