DataTables header alignment issue (Refresh)
DataTables header alignment issue (Refresh)
pratik136
Posts: 1Questions: 0Answers: 0
[quote]
DataTables version: 1.9
Browser affected: Chrome, IE(7/8/9)
[/quote]
Problem
---
When using the `sScrollX`, `sScrollXInner` and/or `sScrollY` to achieve a fixed header table with it's inner content scrolling, the headers of the table go out of alignment with the rest of the body in Chrome and IE(7/8/9). Firefox on the other hand displays them perfectly.
In the latest version 1.9.4, as far as I can tell, this issue only occurs when there is a lot of data with fluctuating widths, and with words that are very long/unwrappable combined in the same columns as small ones. Also the table in question needs to be reasonable wide.
All these factors are demonstrated in this fiddle: http://jsfiddle.net/pratik136/etL73/12/embedded/result/
Output
---
**Chrome:** http://i.stack.imgur.com/4530R.png
**IE:** http://i.stack.imgur.com/6oCLs.png
**Firefox** http://i.stack.imgur.com/1ONsv.png
Suggested Solutions
---
**These solutions have been suggested before but have had no effect** on my implementation. Owing to some of these suggestions, I setup a clean plain vanilla demo as I wanted to ensure that no other code was contributing to this effect.
* turn off all my css, the issue goes away
* `setTimeout( function () { oTable.fnAdjustColumnSizing(); }, 10 );`
* calling `oTable.fnFilter( "x",0 )` and `oTable.fnFilter( "",0 )` in that order
* `"sScrollXInner": "100%"`
* get rid of all widths
The only solution that I found to the misaligned headers was taking out `sScrollX` and `sScrollY`, but this can't be counted as a solution as you lose the fixed header/inner content scrolling functionality. So sadly it's a temporary hack, not a fix!
Note
---
To edit/play with the latest fiddle: http://jsfiddle.net/pratik136/etL73/12
I have tried various combinations which can be observed in the revision history of the fiddle by using the link `http://jsfiddle.net/pratik136/etL73/#REV#` where `1 <= #REV# <=12`
History
---
**External**
This issue ha also been flagged on the DataTables forum:
* http://datatables.net/forums/discussion/7395/sscrolly-and-sscrollx-broken/p1
* http://datatables.net/forums/discussion/7778/vertical-scrolling-messes-up-column-header-alignment#Item_1
* http://datatables.net/forums/discussion/3835/width-columns-problem-in-chrome-safari/p1
**StackO**
This question has been asked before: http://stackoverflow.com/questions/8607290/jquery-datatables-header-misaligned-with-vertical-scrolling
but the vital difference is that the OP of that question mentioned that they were able to fix the issue if all CSS was removed, which is untrue in my case, and I have tried a few permutations, thus thought the question worthy of a repost.
This issue has driven me nuts! Please contribute your thoughts!
DataTables version: 1.9
Browser affected: Chrome, IE(7/8/9)
[/quote]
Problem
---
When using the `sScrollX`, `sScrollXInner` and/or `sScrollY` to achieve a fixed header table with it's inner content scrolling, the headers of the table go out of alignment with the rest of the body in Chrome and IE(7/8/9). Firefox on the other hand displays them perfectly.
In the latest version 1.9.4, as far as I can tell, this issue only occurs when there is a lot of data with fluctuating widths, and with words that are very long/unwrappable combined in the same columns as small ones. Also the table in question needs to be reasonable wide.
All these factors are demonstrated in this fiddle: http://jsfiddle.net/pratik136/etL73/12/embedded/result/
Output
---
**Chrome:** http://i.stack.imgur.com/4530R.png
**IE:** http://i.stack.imgur.com/6oCLs.png
**Firefox** http://i.stack.imgur.com/1ONsv.png
Suggested Solutions
---
**These solutions have been suggested before but have had no effect** on my implementation. Owing to some of these suggestions, I setup a clean plain vanilla demo as I wanted to ensure that no other code was contributing to this effect.
* turn off all my css, the issue goes away
* `setTimeout( function () { oTable.fnAdjustColumnSizing(); }, 10 );`
* calling `oTable.fnFilter( "x",0 )` and `oTable.fnFilter( "",0 )` in that order
* `"sScrollXInner": "100%"`
* get rid of all widths
The only solution that I found to the misaligned headers was taking out `sScrollX` and `sScrollY`, but this can't be counted as a solution as you lose the fixed header/inner content scrolling functionality. So sadly it's a temporary hack, not a fix!
Note
---
To edit/play with the latest fiddle: http://jsfiddle.net/pratik136/etL73/12
I have tried various combinations which can be observed in the revision history of the fiddle by using the link `http://jsfiddle.net/pratik136/etL73/#REV#` where `1 <= #REV# <=12`
History
---
**External**
This issue ha also been flagged on the DataTables forum:
* http://datatables.net/forums/discussion/7395/sscrolly-and-sscrollx-broken/p1
* http://datatables.net/forums/discussion/7778/vertical-scrolling-messes-up-column-header-alignment#Item_1
* http://datatables.net/forums/discussion/3835/width-columns-problem-in-chrome-safari/p1
**StackO**
This question has been asked before: http://stackoverflow.com/questions/8607290/jquery-datatables-header-misaligned-with-vertical-scrolling
but the vital difference is that the OP of that question mentioned that they were able to fix the issue if all CSS was removed, which is untrue in my case, and I have tried a few permutations, thus thought the question worthy of a repost.
This issue has driven me nuts! Please contribute your thoughts!
This discussion has been closed.