浏览代码

Only export table header

Dustin Utecht 6 年之前
父节点
当前提交
d45929bc93
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9 1
      src/extensions/export/bootstrap-table-export.js

+ 9 - 1
src/extensions/export/bootstrap-table-export.js

@@ -44,7 +44,15 @@ $.extend($.fn.bootstrapTable.defaults, {
   showExport: false,
   exportDataType: 'basic', // basic, all, selected
   exportTypes: ['json', 'xml', 'csv', 'txt', 'sql', 'excel'],
-  exportOptions: {},
+  exportOptions: {
+    onCellHtmlData: function (cell, rowIndex, colIndex, htmlData) {
+      if (cell.is('th')) {
+        return cell.find('.th-inner').text()
+      }
+
+      return htmlData;
+    }
+  },
   exportFooter: false
 })