DataTable TableTools Copying Two different table on the same page
DataTable TableTools Copying Two different table on the same page
Hi guys,
I am using tabletools extension. In one page, I have two different datatables with same number of columns actually in both tables. I want to copy data from both tables. But tabletools copies only one table. Also I am using sRowSelect: multi and using fnContainer to pushing all the table tool options in dropdown format. Below is my current code:
//Each datatable example like below
$('#abc').dataTable({
"sAjaxSource": 'abc/get_data',
//"dom": 'T<"clear">lfrtip',
"deferRender": false,
"order": [
[16, 'asc']
], ......
var Table1 = $("#abc").DataTable();
var Table2 = $("#efg").DataTable();
MyTableTools = new $.fn.dataTable.TableTools( Table1 , {
"sSwfPath": "../swf/copy_csv_xls_pdf.swf",
"sRowSelect": 'multi',
"sSelectedClass": 'row_selected',
"bHeader": 'true',
"aButtons": [
{
"sExtends": 'collection',
"sButtonText": 'Tools <span class="caret" />',
"aButtons": [
{
"sExtends": "copy",
"mColumns": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
},
{
"sExtends": "csv",
"mColumns": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
},
{
"sExtends": "xls",
"mColumns": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
},
{
"sExtends": "pdf",
"sPdfOrientation": "landscape",
"sPdfMessage": "You current simulation is as below:",
"mColumns": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
},
{
"sExtends": "print",
"mColumns": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
}
]
}]
} );
$( MyTableTools.fnContainer() ).insertAfter('ul.lastClass');
In above code, if I use MyTableTools = new $.fn.dataTable.TableTools( Table1, Table2 {..., I was expecting both tables getting copied, but its not working this way. Could anyone suggest if this is even possible?
Thanks
Answers
Any update/suggestion on this one, will be helpful. Thanks.