user5405873
user5405873

Reputation:

i'm unable to export html table

i'm using tableexport.js plugin for html table export.

i have a html table like this.

<table id="all_category_data">
 ..
...
.....
</table>

i'n javascript i'm doing something like this

$('#all_category_data').tableExport({ type: 'excel', escape: 'false' });

here is jsfiddle : https://jsfiddle.net/2kt4u8hn/3/

please help me thanks in advance!!

Upvotes: 0

Views: 162

Answers (1)

Nehal J Wani
Nehal J Wani

Reputation: 16619

The documentation clearly states:

To use this plugin, include the jQuery library, FileSaver.js script, and TableExport.js plugin before the closing tag of your HTML document.

In your code, you didn't include jquery and fileserver.js. See below for a working variant of your fiddle.

$('#all_category_data').tableExport({ type: 'excel', escape: 'false' });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.rawgit.com/eligrey/FileSaver.js/e241bd15288553341b3629f5d1e0bc7aaa8a7a38/FileSaver.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/TableExport/3.3.9/js/tableexport.min.js"></script>
<table border=1 id="all_category_data" class="table table-striped table-bordered table-hover">
    <tbody>
        <tr>
            <th>User Name</th>
            <th>User Belongs to</th>
            <th>Total Work Assigned</th>
            <th>Not Emailed</th>
            <th>Email Sent</th>
            <th>Response Recieved</th>
            <th>Interested</th>
            <th>Not Interested</th>
        </tr>
        <tr>
            <td>vidyaranyapura</td>
            <td><span style="color:red;">Not Assigned</span></td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>bangalore</td>
            <td><span style="color:red;">Not Assigned</span></td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>karnataka</td>
            <td><span style="color:#3498db;">Company</span></td>
            <td>200</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>otherstates</td>
            <td><span style="color:red;">Not Assigned</span></td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>global</td>
            <td><span style="color:red;">Not Assigned</span></td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>business</td>
            <td><span style="color:red;">Not Assigned</span></td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>software</td>
            <td><span style="color:red;">Not Assigned</span></td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>placement</td>
            <td><span style="color:#3498db;">Company</span></td>
            <td>28</td>
            <td>28</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>training</td>
            <td><span style="color:red;">Not Assigned</span></td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>realestate</td>
            <td><span style="color:red;">Not Assigned</span></td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>techparks</td>
            <td><span style="color:#3498db;">Company</span></td>
            <td>117</td>
            <td>117</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>tienetwork</td>
            <td><span style="color:#3498db;">Company</span></td>
            <td>2488</td>
            <td>2487</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>linkedin</td>
            <td><span style="color:red;">Not Assigned</span></td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>facebook</td>
            <td><span style="color:red;">Not Assigned</span></td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>individual</td>
            <td><span style="color:red;">Not Assigned</span></td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>schools</td>
            <td><span style="color:red;">Not Assigned</span></td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>colleges</td>
            <td><span style="color:red;">Not Assigned</span></td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>clubs</td>
            <td><span style="color:red;">Not Assigned</span></td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>temples</td>
            <td><span style="color:red;">Not Assigned</span></td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>hospital</td>
            <td><span style="color:red;">Not Assigned</span></td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>financial</td>
            <td><span style="color:red;">Not Assigned</span></td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>marketing</td>
            <td><span style="color:red;">Not Assigned</span></td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>products</td>
            <td><span style="color:red;">Not Assigned</span></td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>mahesh</td>
            <td><span style="color:red;">Not Assigned</span></td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>postmail</td>
            <td><span style="color:red;">Not Assigned</span></td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>landline</td>
            <td><span style="color:red;">Not Assigned</span></td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>email</td>
            <td><span style="color:#3498db;">Company</span></td>
            <td>6932</td>
            <td>6932</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td>whatsapp</td>
            <td><span style="color:red;">Not Assigned</span></td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr style="color:#4A148C;font-size:33px;">
            <td></td>
            <td></td>
            <td>9765 <span style="color:red;font-size:11px;">Total work assigned</span></td>
            <td>9564 <span style="color:red;font-size:11px;">Not Emailed</span></td>
            <td>0 <span style="color:red;font-size:11px;">Email Sent</span></td>
            <td>0 <span style="color:red;font-size:11px;">Response Recieved</span></td>
            <td>0 <span style="color:red;font-size:11px;"> Interested</span></td>
            <td>0 <span style="color:red;font-size:11px;">Not Interested</span></td>
        </tr>
    </tbody>
</table>

Upvotes: 1

Related Questions