Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
641 views
in Technique[技术] by (71.8m points)

jquery - DataTables TableTools buttons not working correctly (simple example)

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..

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...