IE7 header colspan bug
IE7 header colspan bug
jerrosenberg
Posts: 7Questions: 0Answers: 0
Using DataTables 1.8.0. Run this in IE7: http://jsfiddle.net/SUA56/
You can see that the columns are misaligned and confused. It works fine in IE8, 9, and Chrome.
The situation only occurs when you have multiple header rows in the thead with a th in the top row that colspans the bottom row, and there are columns in the colspanned section which are marked invisible in aoColumns, so the colspan of the topmost th should be reduced to only span the visible columns.
I can see that you are calculating and setting the colspan correctly on the th (last line of _fnDrawHead), but unfortunately, IE7 doesn't pick it up when you set it via setAttribute.
If you set the colSpan property directly on the element, it works fine.
You can see that the columns are misaligned and confused. It works fine in IE8, 9, and Chrome.
The situation only occurs when you have multiple header rows in the thead with a th in the top row that colspans the bottom row, and there are columns in the colspanned section which are marked invisible in aoColumns, so the colspan of the topmost th should be reduced to only span the visible columns.
I can see that you are calculating and setting the colspan correctly on the th (last line of _fnDrawHead), but unfortunately, IE7 doesn't pick it up when you set it via setAttribute.
If you set the colSpan property directly on the element, it works fine.
This discussion has been closed.
Replies
[code]<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
[/code]
I don't imagine you'll be able to change that on jsfiddle, but for your production version you can.
http://en.wikipedia.org/wiki/Quirks_mode
http://www.quirksmode.org/css/quirksmode.html
http://www.cs.tut.fi/~jkorpela/quirks-mode.html
http://www.htmlhelp.com/tools/validator/doctype.html
See http://stackoverflow.com/questions/398734/colspan-all-columns/974215#974215
This is caused by a bug in IE7, but there is indeed a bug in datatables by not accounting for it with a known workaround. It is something that could easily be corrected in a future release so I don't have to hack the source to do it myself.
lol - a bug for not working with a bug in a different product! It is most frustrating that bug then. Interestingly fnOpen does work in IE7 ( http://datatables.net/release-datatables/examples/api/row_details.html ) which also uses .rowspan, so I think there is need of a bit more investigation here. I'll look into it a bit.
Allan
that's the web we live in, right? :) I don't mean any offense, just letting you know about a problem..
fnOpen works because you are already doing there what I suggested, setting .colSpan directly on the element. The reason _fnDrawHead does not work is because you are using setAttribute to do it, and IE7 requires you to camel case 'colSpan' when setting it that way.
Thanks for flagging this up and proposing the fix!
Regards,
Allan