IE 7-8 and _fnGetRowElements fail.
IE 7-8 and _fnGetRowElements fail.
Hi Allan,
Thank you for your work!
I still support my apps for IE 7-8 (I know, I know...). So, I updated DataTables plugin to 1.10.1 and have error in _fnGetRowElements because tds is undefined:
...
else {
// Existing row object passed in
tds = row.anCells;
for ( var j=0, jen=tds.length /*fail here.*/ ; j<jen ; j++ ) {
cellProcess( tds[j] );
}
}
I debug _fnGetRowElements and saw that row.firstChild return null and row.childNodes.length == 0 in IE 7-8.
function _fnGetRowElements( settings, row )
{
var
d = [],
tds = [],
td = row.firstChild, -- null here.
...
Temporarily, I wrote something like this:
if (td || !(row.anCells)) {
// `tr` element passed in
while ( td ) {
name = td.nodeName.toUpperCase();
...
I put this in "jquery.dataTables.ie8.js" and include it if needed. It's working for me, but I don't know how much important code in the "else branch".
Actually I do not really understand the logic of this condition. Modern browsers return row.firstChild as text node, but it merely says that the row exists or am I wrong?
Moreover, I briefly looked at the code of the old plugin version, but did not find similar function as _fnGetRowElements.
There may be some correct solution? Any fix or any library for IE 7-8?
Answers
Hello LessWrong. :)
Just wondering if you ever found an answer to your inquiry regarding the logic of the condition checked by this if/else block? If so, would greatly appreciate it if you could share this info, as I'm coming across the same problem with the failure upon reading "tds.length" and am finding it terribly difficult to troubleshoot/understand this. Wondering, did the workaround you put in place prove to be effective over the long-run, or did it give rise to issues downstream at some point? Thanks so much.
The original post (which I missed, sorry) refers to 1.10.1. Have you tried 1.10.5 the current release? Can you link to a test page showing the issue please.
Allan
Hello Allan. First off, thanks so much for your work. DT has become a cornerstone in a handful of our web apps where I work.
I am currently undertaking an update from DT 1.9.0 (with which our web app is working without issue) to DT 1.10.5 and am seeing this issue (browsers used: Firefox 31.1.0 and Chrome Version 40.0.2214.95). The site I am working on is not available publicly, so I will look to either get you more info via the DT debugger (or somehow create an accessible test case if possible).
FYI - the workaround that LessWrong has suggested does (so far) allow things to work without any discernible adverse effects.
Hello LessWrong, thought you may be interested in knowing that Allan had helped me resolve my issue which looks to be similar if not the same as yours.
As Allan explained to me:
"The issue is that when you initialise the DataTable there is an empty <tr> element in the <tbody> (e.g. you have <tbody><tr></tr></tbody>).
Just remove that empty <tr> to resolve the issue.
The reason for this being an error is that DataTables expects there to be a cell for every column in each row. Anything else is an error condition."