gpt4 book ai didi

javascript - 我无法导出 html 表

转载 作者:行者123 更新时间:2023-12-03 05:06:07 25 4
gpt4 key购买 nike

我正在使用 tableexport.js 插件进行 html 表导出。

我有一个像这样的html表。

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

我是javascript我正在做这样的事情

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

这里是 jsfiddle : https://jsfiddle.net/2kt4u8hn/3/

请帮助我提前致谢!!

最佳答案

documentation明确指出:

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

在您的代码中,您没有包含 jquery 和 fileserver.js。请参阅下面的 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>

关于javascript - 我无法导出 html 表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41995848/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com