0
我讀過關於使用dataTable關於頁面上多個表格的文檔。所以,它應該工作。Rails jQuery dataTables頁面上的多個表格無法正常工作
我在選項卡中使用每個表的Bootstrap。每個表格都顯示一些dataTable控件。
第一個表格顯示xls和pdf的tabletools。但是,第2,第3,第n個選項卡顯示了所有的tabletools輸出(xls,pdf,copy,cdv,print等)。除輸出外,其他輸出類型均不起作用。
這裏是我的jQuery:
$(document).ready(function() {
$('.dataTable').dataTable({
"sDom": 'CT<"clear">lfrtip',
"oTableTools": {
"aButtons": [
{
"sExtends": "xls",
"sButtonText": "Excel",
"mColumns": "visible"
},
{
"sExtends": "pdf",
"sPdfOrientation": "landscape",
"sPdfMessage": "Endeavor",
"mColumns": "visible"
}
],
"sSwfPath": "/swf/copy_cvs_xls_pdf.swf"
},
"oColVis": {
"buttonText": "Show/Hide",
"aiExclude": [ 0 ],
"bRestore": true,
"sAlign": "left"
},
"bStateSave": true,
"fnStateSave": function (oSettings, oData) {
localStorage.setItem('DataTables_'+window.location.pathname, JSON.stringify(oData));
},
"fnStateLoad": function (oSettings) {
return JSON.parse(localStorage.getItem('DataTables_'+window.location.pathname));
}
});
這裏是第2代表的HTML表格元素:
<table class="display dataTable table table-striped table-bordered" id="dataTable1" style="" aria-describedby="dataTable1_info">
<table class="display dataTable table table-striped table-bordered" id="dataTable2" style="" aria-describedby="dataTable2_info">
任何幫助,將不勝感激!
感謝您的信息! – Reddirt