ソースを参照

Merge pull request #6078 from wenzhixin/fix/bug-6007

Fixed the toggle column bug with the cookie extension
Dustin Utecht 3 年 前
コミット
a86c8de7b5
1 ファイル変更6 行追加4 行削除
  1. 6 4
      src/extensions/cookie/bootstrap-table-cookie.js

+ 6 - 4
src/extensions/cookie/bootstrap-table-cookie.js

@@ -481,7 +481,11 @@ $.BootstrapTable = class extends $.BootstrapTable {
 
     if (columnsCookie) {
       for (const column of this.columns) {
-        const filteredColumns = columnsCookie.filter(columnField => {
+        if (!column.switchable) {
+          continue
+        }
+
+        column.visible = columnsCookie.filter(columnField => {
           if (this.isSelectionColumn(column)) {
             return true
           }
@@ -495,9 +499,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
           }
 
           return columnField === column.field
-        })
-
-        column.visible = (filteredColumns.length > 0 || !column.switchable) && column.visible
+        }).length > 0
       }
     }
   }