【发布时间】:2015-08-05 11:40:54
【问题描述】:
我用过https://www.datatables.net的例子 以下是我的 jQuery
<script type="text/javascript">$(document).ready(function () {var data = <%=liveProjectData %>
$("#empdetails").html('<table id="example" class="table-responsive table-bordered table-hover" ></table>');
$("#example").dataTable({
"oTableTools": {
"sSwfPath": "http://cdn.datatables.net/tabletools/2.2.2/swf/copy_csv_xls_pdf.swf",
"aButtons": ["xls", "pdf", "print"]
},
"columns": [{
"title": "A"
}, {
"title": "B"
}, {
"title": "C"
}, {
"title": "D"
}, {
"title": "E"
}
],
"data": function () {
return $.map(data, function (attribute) {
return [
["<div class='badge badge-" + attribute.A + "'>" + attribute.A + "</div>", attribute.B, attribute.C, attribute.D, attribute.E, '<a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-ok" onclick="EditProjectDetails(' + attribute.A + ')">EDIT</a>'] ] })}()}) }); function EditProjectDetails(A) { window.location = "viewClientDetailToAdmin.aspx?A=" + A };
我已将数据绑定到以下 div
<div class="row"> <div class="col-md-12" id="empdetails"></div></div>
我在https://www.datatables.net/extensions/tabletools/ 阅读了有关数据表工具的信息 将 HTML 表格数据导出为 pdf、excel
请帮我在 Excel 中下载我绑定的 HTML 表格中的任何内容。
提前谢谢...
【问题讨论】:
标签: jquery asp.net excel datatable jquery-datatables