【发布时间】:2011-10-24 19:00:50
【问题描述】:
我正在使用带有 jQuery 的 DataTables 插件,我已经查看了 StackOverflow 并发现 this other question 几乎有同样的问题(除了我没有标签),我尝试了它所说的但无法让它工作.我在表格中有这个下拉菜单,只显示 50 条记录(下面代码中的 iDisplayLenth),当您选择 100 或超过表格时,表格会完全调整大小,我不知道为什么。任何帮助或建议将不胜感激。这是我用于创建表格的 HTML:
<table id="content-table-redesign" class="display">
然后是与之相关的css
#content-table-redesign{border-collapse: separate;width:1241px;margin:0 auto;}
#content-table-redesign th{min-width:45px;color:#2e2e2e;}
此时的 js 几乎是我最初拥有的内容和我在另一个链接上找到的建议的混合体。一切都在 $document(function(){});
var oTable = $('#content-table-redesign').dataTable({
"oLanguage": {
"sLengthMenu": "Display _MENU_ records per page",
"sZeroRecords": "Nothing found - sorry",
"sInfo": "Showing _START_ to _END_ of _TOTAL_ records",
"sInfoEmpty": "Showing 0 to 0 of 0 records",
"sInfoFiltered": "(filtered from _MAX_ total records)"
},
"aaSorting": [[ 0, "asc" ]],
"bAutoWidth": false,
"iDisplayLength": 50,
"aLengthMenu": [10, 20, 30, 50, 100, 500],
"sPaginationType": "full_numbers",
"sDom": '<"top"i><"#up"f>rt<"#bottom2"l><"pagin"p><"clear">',
"aoColumns" : [
{ sWidth: '500px' },
{ sWidth: '1000px' },
{ sWidth: '1200px' },
{ sWidth: '300px' },
{ sWidth: '100px' },
{ sWidth: '120px' },
{ sWidth: '30px' },
{ sWidth: '100px' },
{ sWidth: '120px' }
]
});
oTable.fnAdjustColumnSizing();
我刚刚意识到这个错误只出现在 IE8 和 Chrome 12+ 上
【问题讨论】:
标签: jquery jquery-plugins datatables