浏览代码

fix(export extension): fix #4086, export in cardView display error

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

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

@@ -153,14 +153,18 @@
       }
 
       const stateField = this.header.stateField
+      const isCardView = o.cardView
 
+      if (stateField) {
+        this.hideColumn(stateField)
+      }
+      if (isCardView) {
+        this.toggleView()
+      }
       if (o.exportDataType === 'all' && o.pagination) {
         const eventName = o.sidePagination === 'server'
           ? 'post-body.bs.table' : 'page-change.bs.table'
         this.$el.one(eventName, () => {
-          if (stateField) {
-            this.hideColumn(stateField)
-          }
           doExport()
           this.togglePagination()
         })
@@ -184,20 +188,17 @@
         }
 
         this.load(selectedData)
-        if (stateField) {
-          this.hideColumn(stateField)
-        }
         doExport()
         this.load(data)
       } else {
-        if (stateField) {
-          this.hideColumn(stateField)
-        }
         doExport()
       }
       if (stateField) {
         this.showColumn(stateField)
       }
+      if (isCardView) {
+        this.toggleView()
+      }
     }
   }
 })(jQuery)