TableTools using custom button.
TableTools using custom button.
rrecoba
Posts: 3Questions: 0Answers: 0
Hello,
I want to use the PDF button provided by TableTools, but i need this action to be linked to my own button, no the ones generated by TableTools. Is this possible?
I need to do this because my button for export to pdf, is in a very different place in the page (in a sidebar at the left of the screen).
Thanks
I want to use the PDF button provided by TableTools, but i need this action to be linked to my own button, no the ones generated by TableTools. Is this possible?
I need to do this because my button for export to pdf, is in a very different place in the page (in a sidebar at the left of the screen).
Thanks
This discussion has been closed.
Replies
In short - no. Having said that, you can put the TableTools button anywhere you want in the DOM ( http://datatables.net/release-datatables/extras/TableTools/alt_init.html ) and style it however you need using CSS. Indeed you can even change what tags are used through the initialisation options.
Allan
I´m having another issue right now.
I downloaded datatables packages, and copy de the extraced directory inside the examples directory of datatables package. As a result i see a working page but the only button that woks is the print one. I tryied modifying the path to the swf without success, any idea?
R.-
1. The swf isn't being loaded
2. The TableTools element is being initialised while hidden, and thus can't get the sizes to draw for the Flash movie. For this you need to use the API to adjust the size when it is in the DOM:
http://datatables.net/extras/tabletools/api
fnResizeRequired and fnResizeButtons
Allan
Now i´ve modified a little the code in the example: http://datatables.net/release-datatables/extras/TableTools/alt_init.html, but without succes.
Here is my code:
[code]
$(document).ready( function () {
var oTable = $('#example').dataTable();
var oTableTools = new TableTools( oTable, {
"sSwfPath": "media/swf/copy_csv_xls_pdf.swf",
"buttons": [
"copy",
"csv",
"xls",
"pdf",
{ "type": "print", "buttonText": "Print me!" }
]
} );
$('#demo').before( oTableTools.dom.container );
oTableTools.fnResizeRequired(true);
oTableTools.fnResizeButtons();
} );
[/code]
Regards,