我正在使用 DataTables,TableTools 显示 2 个表。我正在为我的菜单使用Easy Tabs jQuery 插件,并且在不同的选项卡上显示 2 个表格。由于按钮的元素display: none
没有高度/宽度,因此无法正确调整 Flash 按钮的大小,并且您无法单击 0x0 元素。
我需要使用tabletools fnresizebuttons()方法来调整选项卡时调整按钮的大小。
选项卡(div)通过 CSS 隐藏:
#tabcontent2, #tabcontent3, #tabcontent4,{
display: none;}
这是我的 fnResizeButtons 和初始化 DataTables & TableTools 的脚本:
/**Begin script to resize buttons when div made visible *******************/
$("#tabcontent1, #tabcontent2").tabs( {
"show": function(event, ui) {
var jqTable = $('table.display', ui.panel);
if ( jqTable.length > 0 ) {
var oTableTools = TableTools.fnGetInstance( jqTable[0] );
if ( oTableTools != null && oTableTools.fnResizeRequired() ){
/* A resize of TableTools' buttons and DataTables'
* columns is only required on the
* first visible draw of the table
*/
jqTable.dataTable().fnAdjustColumnSizing();
oTableTools.fnResizeButtons();
} //end if
} //end
} //end "show": function(event, ui) {
} ); //end $("#tabcontent1, #tabcontent2").tabs( {
} ); //end $(document).ready(function()
/**Begin Initialisation oTable**************/
var oTable = {};
$(document).ready( function () {
oTable = $('#claims').dataTable( {
"oLanguage": {
"sSearch": "Search all columns:"
}, //end <a href="/ref#oLanguage">oLanguage</a>
"sPaginationType": "full_numbers",
// initialize Table Tools
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
// setting SWF path
"sSwfPath": ["swf/copy_csv_xls_pdf.swf"],
// buttons
"aButtons": [
{ "sExtends": "copy",
"bFooter": false
}, // end sExtends
{ "sExtends": "print",
"bFooter": false
}, // end sExtends
{ "sExtends": "csv",
"bFooter": false
}, // end sExtends
{ "sExtends": "xls",
"bFooter": false
}, // end sExtends
{ "sExtends": "pdf",
"bFooter": false,
"sPdfOrientation": "landscape"
} // end sExtends
] //end aButtons
} //end oTableTools
} ); //end #example .dataTable
} ); //end $(document).ready(function()
/**Begin Initialisation froi table****************************/
var froiTable = {};
$(document).ready( function () {
froiTable = $('#froi').dataTable( {
"bPaginate": false,
"bFilter": false,
"bSort": false,
// initialize Table Tools
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
// setting SWF path
"sSwfPath": ["swf/copy_csv_xls_pdf.swf"],
// buttons
"aButtons": [
"print",
"pdf"
] //end aButtons
} //end oTableTools
} ); //end #froi .dataTable
} ); //end $(document).ready(function()
这是我的菜单和 div 代码:
<div id="tabs" class="menu"> <!--Start menu -->
<ul>
<li><a href="#" onmouseover="easytabs('1', '1');" onfocus="easytabs('1', '1');" onclick="return false;" title="" id="tablink1" >Tabcontent 1</a></li>
<li><a href="#" onmouseover="easytabs('1', '2');" onfocus="easytabs('1', '2');" onclick="return false;" title="" id="tablink2" >Tabcontent 2</a></li>
<li><a href="#" onmouseover="easytabs('1', '3');" onfocus="easytabs('1', '3');" onclick="return false;" title="" id="tablink3">Tabcontent 3</a></li>
<li><a href="#" onmouseover="easytabs('1', '4');" onfocus="easytabs('1', '4');" onclick="return false;" title="" id="tablink4" >Tabcontent 4</a></li>
</ul>
</div> <!--End menu -->
<div id="tabcontent1">
<!--Code for Table goes here -->
</div> <!--End Tabcontent 1-->
<div id="tabcontent2">
<!--Code for Table goes here -->
</div><!--End Tabcontent 2 -->
<div id="tabcontent3">
</div><!--End Tabcontent 3-->
<div id="tabcontent4">
</div><!--End Tabcontent 4-->
我相信我的问题在于当 div 可见时调整按钮大小的脚本(fnResizeButtons 脚本)。
我错过了什么?