ソースを参照

Merge pull request #5493 from wenzhixin/fix/5426

Dont export the detail view icon column
文翼 5 年 前
コミット
61ac97252e
2 ファイル変更10 行追加1 行削除
  1. 4 1
      src/bootstrap-table.js
  2. 6 0
      src/extensions/export/bootstrap-table-export.js

+ 4 - 1
src/bootstrap-table.js

@@ -252,7 +252,10 @@ class BootstrapTable {
       let detailViewTemplate = ''
 
       if (i === 0 && Utils.hasDetailViewIcon(this.options)) {
-        detailViewTemplate = `<th class="detail" rowspan="${this.options.columns.length}">
+        const rowspan = this.options.columns.length > 1 ?
+          ` rowspan="${this.options.columns.length}"` : ''
+
+        detailViewTemplate = `<th class="detail"${rowspan}>
           <div class="fht-cell"></div>
           </th>`
       }

+ 6 - 0
src/extensions/export/bootstrap-table-export.js

@@ -196,6 +196,12 @@ $.BootstrapTable = class extends $.BootstrapTable {
 
       const data = this.getData()
 
+      if (o.detailView && o.detailViewIcon) {
+        const detailViewIndex = o.detailViewAlign === 'left' ? 0 : this.getVisibleFields().length + Utils.getDetailViewIndexOffset(this.options)
+
+        o.exportOptions.ignoreColumn = [detailViewIndex].concat(o.exportOptions.ignoreColumn || [])
+      }
+
       if (o.exportFooter) {
         const $footerRow = this.$tableFooter.find('tr').first()
         const footerData = {}