JQuery Datatables 在IE浏览器表头显示错乱问题

来源:互联网 发布:网络七层协议工作原理 编辑:程序博客网 时间:2024/06/05 17:46

          JQuery Datatables 在IE浏览器表头显示错乱问题,如下图:


         

        但在其他浏览器:火狐、谷歌、百度都是显示正常的,这个IE11的浏览器上方的标题并没有自动去适配宽度,后来发现表格有一个属性:"bAutoWidth": false,,设置为false就可以防止这个问题,接下来就可以使用一些空格来调整,参考如下网址内容:http://stackoverflow.com/questions/13178039/datatables-fixed-headers-misaligned-with-columns-in-wide-tables

 

I am having the same issue on IE9.

I will just use a RegExp to strip all the white spaces before writing the HTML to the page

var Tables=$('##table_ID').html();var expr = new RegExp('>[ \t\r\n\v\f]*<', 'g');Tables= Tables.replace(expr, '><');$('##table_ID').html(Tables);oTable = $('##table_ID').dataTable( {  "bPaginate": false,  "bLengthChange": false,  "bFilter": false,  "bSort": true,  "bInfo": true,  "bAutoWidth": false,  "sScrollY": ($(window).height() - 320),  "sScrollX": "100%",  "iDisplayLength":-1,  "sDom": 'rt<"bottom"i flp>'} );     
 运行结果为:



0 0
原创粉丝点击