DataTables / TableTools

Please note that TableTools has now been retired and replaced by the Buttons and Select extensions which offers significant improvements and API integration with the rest of DataTables and the other extensions.
http://datatables.net/
Other
237 stars 149 forks source link

Correct way to use Table tools ? Can't get save, copy button container to appear #95

Closed chaithuzz2 closed 9 years ago

chaithuzz2 commented 9 years ago

Hi,

First of all, thanks for this great extension to data tables. I want to have the option of saving tables as an excel and pdf file. I tried doing it as it says in documentation. But somehow it's not working. My code is below. I have data tables zip in my project directory

Src includes

    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/plug-ins/1.10.6/integration/bootstrap/3/dataTables.bootstrap.css">
        <link href="css/styles.css" rel="stylesheet">
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    <script type="text/javascript" language="javascript" src="https://cdn.datatables.net/1.10.6/js/jquery.dataTables.min.js"></script>
    <script type="text/javascript" language="javascript" src="https://cdn.datatables.net/plug-ins/1.10.6/integration/bootstrap/3/dataTables.bootstrap.js">
    </script>
    <link rel="stylesheet" type="text/css" href="DataTables-1.10.7/extensions/TableTools/css/dataTables.tableTools.min.css">
    <script type="text/javascript" src="DataTables-1.10.7/extensions/TableTools/js/dataTables.tableTools.min.js"></script>

Syntax of dataTable initialization

$('#main_table').dataTable({
            "iDisplayLength": 50,
            "order" : [[0,"desc"]],
            "Dom": 'T<"clear">lfrtip',
            "tableTools": {
            "sSwfPath": "../swf/copy_csv_xls_pdf.swf"
            } 
});

When I do this, there is no button container appearing that allows us to save table as different formats. Please tell me how to solve this. Thanks for your help.

DataTables commented 9 years ago

Can you ask support questions in the DataTables forums please? Also, please link to a test case showing the issue to it can be debugged.

chaithuzz2 commented 9 years ago

Thanks for the quick response. Here's a link to the discussion. Cheers!

https://datatables.net/forums/discussion/27915/correct-way-to-use-table-tools-can-t-get-the-save-as-excel-or-pdf-button-pane-to-appear

MrGeneric commented 9 years ago

Hey, sorry for not using the forum but I'm not registered there. I had a look at your sample and you've used "Dom" instead of "dom" when initialising the dataTable. Change that and the buttons will appear.

chaithuzz2 commented 9 years ago

Hi MrGeneric,

Thank you so much. It's up and running well. I appreciate you for taking time to look at this and spotting the error.

Cheers, Krishna Chaitanya Chavati