Table Tool Buttons Not Working (inside DIVs) w/ JQuery Tabs
Table Tool Buttons Not Working (inside DIVs) w/ JQuery Tabs
bgearrin
Posts: 3Questions: 0Answers: 0
Hi,
I am having a problem making the buttons work as intended with table tools. When implemented, the CSV and PDF buttons do not do anything when they are clicked and I think its related to a DIV problem. I have verified Data Tables and Table Tools work by removing all DIVs and only using one DIV on the page (I am running the latest version of Data Tables and Table Tools).
Any ideas on why this wouldn't work with 2 DIVs and the table inside?
[code]
[/code]
[code]
$(document).ready(function () {
$('#test').dataTable({
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "/media/swf/copy_csv_xls_pdf.swf",
"aButtons": ["csv", "pdf", "print"]
}
});
[/code]
[code]
ID
Name
1
2
3
4
[/code]
Any help would be greatly appreciated!
I am having a problem making the buttons work as intended with table tools. When implemented, the CSV and PDF buttons do not do anything when they are clicked and I think its related to a DIV problem. I have verified Data Tables and Table Tools work by removing all DIVs and only using one DIV on the page (I am running the latest version of Data Tables and Table Tools).
Any ideas on why this wouldn't work with 2 DIVs and the table inside?
[code]
[/code]
[code]
$(document).ready(function () {
$('#test').dataTable({
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "/media/swf/copy_csv_xls_pdf.swf",
"aButtons": ["csv", "pdf", "print"]
}
});
[/code]
[code]
ID
Name
1
2
3
4
[/code]
Any help would be greatly appreciated!
This discussion has been closed.
Replies
My issue was directly related to JQuery Tabs with Table Tools Buttons not working. Info can be found here:
http://datatables.net/forums/discussion/3783/x&page=1#Item_4
https://github.com/DataTables/TableTools/blob/master/tabs.html
I also implemented the same thing but there is no action when i click on the buttons.
What should I do . Please suggest me something I stuck.
My code is
$('#table1').dataTable( {
"bJQueryUI": true,
/* "sPaginationType": "full_numbers", */
"bProcessing": true,
"bServerSide": true,
"bDestroy": true,
"bAutoWidth": true,
"sScrollX": "940px",
//"sScrollY": "250px",
"bScrollCollapse": true,
"aoColumns": [
null,
null,
null,
null,
null,
null,
{ "bSortable": false }
] ,
"sDom": 'T<"clear"><"H"lfr>t<"F"ip>',
"oTableTools": {
//"sSwfPath": "/public/swf/ZeroClipboard.swf",
"sSwfPath": "//swf/copy_csv_xls_pdf.swf",
"aButtons": [
"copy",
"csv",
"xls",
{
//"sExtends": "collection",
"sExtends": "pdf",
"sTitle": "Report Name",
"sPdfMessage": "Summary Info",
"sPdfOrientation": "landscape",
//"sSwfPath": "/swf/ZeroClipboard.swf",
"fnClick": function( nButton, oConfig ) {
this.fnPrint( true, oConfig );
},
"print"
]
},
"sAjaxSource": url,
"fnServerData": function ( sSource, aoData, fnCallback ) {
// Add some extra data to the sender
//aoData.push();
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
} );
}
});
The buttons of TableTools are getting displayed but nothing is happening on clicking on them,
secondly, the swf path should not be absolute,
//swf/copy_csv_xls_pdf.swf",
Use the below path and make sure ur swf is in the appropriate folder
swf/copy_csv_xls_pdf.swf",
[code]
$('.nav-tabs a[data-toggle="tab"]').on('shown', function(e) {
var ttInstances = TableTools.fnGetMasters();
for (var i in ttInstances) {
if (ttInstances[i].fnResizeRequired())
ttInstances[i].fnResizeButtons();
}
});
[/code]
You get the idea.
tabletools * Version: 2.1.5.dev and jquery v1.8.3 but still can get tabletools to work on all tabs.
(Tabs loaded via ajax and different jsp pages ). Flash is working properly.
On the first tab everything works perfectly. 2nd tab onwards, flash works. when i click copy, it says zero rows copied. I dont know. Though the tabletools are loaded, it somehow is not able to capture data or something.
when the tabs directly load the data , the tabletools doesnt work. but when i populate the table after an event , say based on a select statement populate the table, the tabletools start working.
Just stuck on this one.