浏览代码

fix #4193: Fixed export all rows to pdf bug.

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

+ 21 - 15
src/extensions/export/bootstrap-table-export.js

@@ -122,7 +122,7 @@
       const stateField = this.header.stateField
       const isCardView = o.cardView
 
-      const doExport = () => {
+      const doExport = callback => {
         if (stateField) {
           this.hideColumn(stateField)
         }
@@ -153,26 +153,31 @@
           })
         }
 
-        this.$el.tableExport($.extend({}, o.exportOptions, options))
+        this.$el.tableExport($.extend({
+          onAfterSaveToFile: () => {
+            if (o.exportFooter) {
+              this.load(data)
+            }
 
-        if (o.exportFooter) {
-          this.load(data)
-        }
+            if (stateField) {
+              this.showColumn(stateField)
+            }
+            if (isCardView) {
+              this.toggleView()
+            }
 
-        if (stateField) {
-          this.showColumn(stateField)
-        }
-        if (isCardView) {
-          this.toggleView()
-        }
+            callback()
+          }
+        }, o.exportOptions, options))
       }
 
       if (o.exportDataType === 'all' && o.pagination) {
         const eventName = o.sidePagination === 'server'
           ? 'post-body.bs.table' : 'page-change.bs.table'
         this.$el.one(eventName, () => {
-          doExport()
-          this.togglePagination()
+          doExport(() => {
+            this.togglePagination()
+          })
         })
         this.togglePagination()
       } else if (o.exportDataType === 'selected') {
@@ -194,8 +199,9 @@
         }
 
         this.load(selectedData)
-        doExport()
-        this.load(data)
+        doExport(() => {
+          this.load(data)
+        })
       } else {
         doExport()
       }