2015-05-23 84 views
-1

我用https://www.datatables.net例如 以下是我的jQuery导出HTML数据表到Excel

<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表格中我已经绑定了。

在此先感谢...

回答