Browse Source

Merge pull request #4279 from wenzhixin/fix/4005

Only export table header
文翼 6 years ago
parent
commit
f6ae7feb51
1 changed files with 9 additions and 1 deletions
  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
 })