100% width tables with vertical & horizontal scroll?
100% width tables with vertical & horizontal scroll?
I current use DataTables in an application, and I fight with it all the time because I have an elastic application: the tables stretch to the viewport, but when the data gets to be too much for the data, a scrollbar appears: the best of both worlds....
My current problem, is that I want to do horizontal and vertical scrolling, and DataTables can handle it, just not in the 100% width context (that resizes as the browser expands & shrinks, and smartly puts a scrollbar when the table can't shrink anymore). Any ideas?
My current problem, is that I want to do horizontal and vertical scrolling, and DataTables can handle it, just not in the 100% width context (that resizes as the browser expands & shrinks, and smartly puts a scrollbar when the table can't shrink anymore). Any ideas?
This discussion has been closed.
Replies
Links to test cases are below:
http://jsbin.com/opabi3/26
or
http://jsbin.com/opabi3/26/edit
Notable bugs: [code] All bugs look like they are fixed (Firefox is a little choppy when scrolling however)[/code]
For those who don't know how to use jsbin, the number at the end is the revision: change that number to look through previous revisions (since I'm currently hacking on this).
http://jsbin.com/opabi3/15
[code]
$(document).resize(function() { $("#example1").dataTable().fnAdjustColumnSizing();};
[/code]
This should take care of the width aspect when resizing.
Hope this helps.
-Chris
cdaigle: I plugged the code into the page previously posted (on jsbin) and while it controls some aspects, things like header (I'm pretty sure) it doesn't control completely. I'll report back and see what I can find.
Edit: ok so I'm pretty sure that has an adverse hit on performance, but besides the point:
I've updated my example with your code snippet (slightly alterated)... the 2 issues is that horizontal scroll doesn't work for the header.. and the more pertinent issue is that since the header & footer are no longer directly apart of the table, when the browser width compresses, the cells become misaligned. Take a look at my updated code example I put in my 3rd post.
Edit: it looks like your code along with some alterations, it now works. I want to add a load spinner with an overlay on the tables so that instead of resizing every single resize event, just stop displaying the table upon resize (or blur it out) and then when the user stops resizing, then readjust the columns and then fade out the spinner.