<script type="text/javascript">
$(document).ready( function () {
$('#table_id').DataTable();
});
</script>
<body>
<table id="table_id" class="display">
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
</tr>
</thead>
<tr>
<td>Row 1 Data 1</td>
<td>Row 1 Data 2</td>
</tr>
<tr>
<td>Row 2 Data 1</td>
<td>Row 2 Data 2</td>
</tr>
</tbody>
</table>
</body>
这是我用来处理数据表的,但我无法使用其 PDF XML 导出器插件名称表工具http://www.datatables.net/extensions/tabletools/
你首先需要脚本。
- jquery.js
- 数据表.js
- 表工具.js
- 数据表.css
- 表工具.css
- SWF 路径
然后,您需要设置数据表。喜欢:
$(document).ready(function() {
$('#example').DataTable( {
"dom": 'T<"clear">lfrtip',
"tableTools": {
"sSwfPath": "media/swf/copy_csv_xls_pdf.swf",
"aButtons": [
"copy",
"print",
{
"sExtends": "collection",
"sButtonText": "Save",
"aButtons": [ "csv", "xls", "pdf" ]
}
]
}
} );
} );
试试自己,如果你有任何问题,请回到这里。
在此链接:示例中,有几个示例。
希望这有帮助。