table2excel排除不起作用 [英] table2excel exclude not working
本文介绍了table2excel排除不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$("td:hidden").addClass("noExl");
$("#estTbl").table2excel({
exclude: ".noExl",
name: "file1",
filename: projectCode+'-'+ startDate+' to'+ endDate ,
fileext: ".xls",
exclude_img: true,
exclude_links: true,
exclude_inputs: true
});
这不排除隐藏的TD.如何手动将"noExl"添加到隐藏的TD.
This doesn't exclude hidden TDs. How can i add "noExl" manually to hidden TDs.
推荐答案
您可以隐藏单个 td
,但在这种情况下,下一个td会在上一个隐藏的td处移动,请参见以下代码段,
You can hide a single td
but in that case the next td will move in the place previous hidden td see below snippet,
jQuery(document).ready(function() {
$('#export-btn').on('click', function(e){
$("#estTbl").table2excel({
exclude: ".noExl",
name: "Data",
filename: "tblExport.xlsx",
});
});
});
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="//cdn.rawgit.com/rainabba/jquery-table2excel/1.1.0/dist/jquery.table2excel.min.js"></script>
<button id="export-btn">Export</button>
<table id="estTbl">
<thead>
<tr class="noExl">
<td>This shouldn't get exported</td>
<td>This shouldn't get exported either</td>
</tr>
<tr>
<td>This Should get exported as a header</td>
<td>This should too</td>
</tr>
</thead>
<tbody>
<tr>
<td class="noExl">This too data1a</td>
<td>data1b</td>
</tr>
<tr>
<td>data2a</td>
<td>data2b</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2">This footer spans 2 cells</td>
</tr>
</tfoot>
</table>
这篇关于table2excel排除不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文