DataTables TableTools buttons not working correctly (simple example)

user3013163 picture user3013163 · Apr 22, 2014 · Viewed 17.5k times · Source

I am trying to use the newest tableTool 2.2.0 and i have made a little and simple example jsfiddle.net/9ZTGb/

COPY and PRINT buttons seems to respond, but the "Copy" is resulting "blank", and "CSV","Excel","PDF" seems not workinkg at all..

this is the table:

<table id="tblExport" class="table table-condensed">
    <thead>
        <tr>
            <th>#</th>
            <th>First Name</th>
            <th>Last Name</th>
            <th>Username</th>
            <th>Status</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>1</td>
            <td>Larry</td>
            <td>Smith</td>
            <td>@lsmith</td>
            <td>Approved</td>
        </tr>
        <tr>
            <td>2</td>
            <td>Mark</td>
            <td>Williams</td>
            <td>@mwills</td>
            <td>Pending</td>
        </tr>
        <tr>
            <td>3</td>
            <td>Jeremy</td>
            <td>Jones</td>
            <td>@jj</td>
            <td>Success</td>
        </tr>
        <tr>
            <td>4</td>
            <td>Carlos</td>
            <td>Martin</td>
            <td>@cmar</td>
            <td>Suspende</td>
        </tr>
    </tbody>
</table>

and this is the js script:

$(document).ready(function () {
     $('#tblExport').dataTable({
         "sDom": 'T<"clear">lfrtip',
             "oTableTools": {
             "sSwfPath": "https://datatables.net/release-datatables/extras/TableTools/media/swf/copy_csv_xls_pdf.swf",
                 "aButtons": ["copy", "csv", "xls", "pdf", "print"]
         }
     });
 });

I would really appreciate if someone could tell me why it isn't working. the example here and the jsfiddle i tried to make as simple as possible, but still not really working..

Answer

user3675977 picture user3675977 · May 26, 2014

sSwfPath : Flash file Security is the Issue:

Solution:

Step 1: Check For sDom Property.

Step 2: Check the SWF Path is correct. If its correct

Step 3: Open Flash Manager :

http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html

Under 3rd Tab, Global Settings Add the Site Url Which contains SWF Path. Select Always Allow Option.

Then Try the Save PDF By Refresh.