直接上代码:
export1 = function () {
var set = [];
$('table thead tr').each(function () { var row = []; $(this).find('th').each(function () { row.push($(this).text()); }); set.push(row); });
var tb = [];
$('table tbody tr').each(function () { var row = []; $(this).find('td').each(function () { row.push($(this).text()); }); tb.push(row); });
table.exportFile(set, tb, 'csv');
}
直接触发export1这个事件就可以导出表格了