datatable in IE 9 bug with large tables
datatable in IE 9 bug with large tables
privratnik
Posts: 1Questions: 0Answers: 0
Hi
In the table with a large number of rows are extra blank columns and breaks the table (this problem only in IE 9) to correct the problem.
In the table with a large number of rows are extra blank columns and breaks the table (this problem only in IE 9) to correct the problem.
This discussion has been closed.
Replies
It is a known and well documented problem with IE browsers (including IE9) with LARGE tables that contains whitespace characters within it. This happens regardless of whether or not you are using DataTables.
Try adding this JavaScript code in a separate code block at the VERY BOTTOM of the page code AFTER the table code has been completed (and closed) and all other page content has been rendered.
Personally, I enclose it in a JS "Try / Catch" loop for backwards browser compatibility.
[code]
// Remove all white spacing from the DOM layout of the dynamic table
var expr = new RegExp('>[ \t\r\n\v\f]*<', 'g');
document.body.innerHTML = document.body.innerHTML.replace(expr, '><');
[/code]
Try it! As long as the rest of the page code is well formed (and the page is successfully completely loaded), I'll bet that you'll suddenly see the "random" layout errors disappear.
At least it worked for me, after I spent weeks trying to solve the same problem!
Hope that helps!
-Russ.
I noticed that salvipascual later posted what may be a better solution:
While I haven't tested it, he indicated that his version (below) removed all whitespace within the datatable itself rather than from the entire HTML code page:
[code]
var expr = new RegExp('>[ \t\r\n\v\f]*<', 'g');
var tbhtml = $('#datatable').html();
$('#datatable').html(tbhtml.replace(expr, '><'));
[/code]
Allan
Thanks rjones and salvipascual.
Marc
Allan
What is the reason the sorting functionality stops working and how to make it work again?
I would appreciate any help.
I've sent nowords a message to see if we can figure out what the relevant difference is between our code. Will update if we find out more.
[code]
$(document).ready(function () {
//My Table INIT
//Table RegEX fix
}
[/code]
but :) it is crucial as mentioned rjones to run it before table init.
now.
this is works:
[code]
$(document).ready(function () {
//Table RegEX fix
//My Table INIT
}
[/code]
Thanks a lot for help.