浏览代码

Fix #4155: Fixed export selected bug.

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

+ 17 - 17
src/extensions/export/bootstrap-table-export.js

@@ -119,9 +119,17 @@
 
     exportTable (options) {
       const o = this.options
+      const stateField = this.header.stateField
+      const isCardView = o.cardView
 
       const doExport = () => {
-        const that = this
+        if (stateField) {
+          this.hideColumn(stateField)
+        }
+        if (isCardView) {
+          this.toggleView()
+        }
+
         const data = this.getData()
         if (o.exportFooter) {
           const $footerRow = this.$tableFooter.find('tr').first()
@@ -130,7 +138,7 @@
 
           $.each($footerRow.children(), (index, footerCell) => {
             const footerCellHtml = $(footerCell).children('.th-inner').first().html()
-            footerData[that.columns[index].field] = footerCellHtml === ' ' ? null : footerCellHtml
+            footerData[this.columns[index].field] = footerCellHtml === ' ' ? null : footerCellHtml
 
             // grab footer cell text into cell index-based array
             footerHtml.push(footerCellHtml)
@@ -150,17 +158,15 @@
         if (o.exportFooter) {
           this.load(data)
         }
-      }
 
-      const stateField = this.header.stateField
-      const isCardView = o.cardView
-
-      if (stateField) {
-        this.hideColumn(stateField)
-      }
-      if (isCardView) {
-        this.toggleView()
+        if (stateField) {
+          this.showColumn(stateField)
+        }
+        if (isCardView) {
+          this.toggleView()
+        }
       }
+
       if (o.exportDataType === 'all' && o.pagination) {
         const eventName = o.sidePagination === 'server'
           ? 'post-body.bs.table' : 'page-change.bs.table'
@@ -193,12 +199,6 @@
       } else {
         doExport()
       }
-      if (stateField) {
-        this.showColumn(stateField)
-      }
-      if (isCardView) {
-        this.toggleView()
-      }
     }
   }
 })(jQuery)