ソースを参照

Added a check for the old cookies

Dustin Utecht 5 年 前
コミット
995bbd480a
1 ファイル変更12 行追加1 行削除
  1. 12 1
      src/extensions/cookie/bootstrap-table-cookie.js

+ 12 - 1
src/extensions/cookie/bootstrap-table-cookie.js

@@ -468,7 +468,18 @@ $.BootstrapTable = class extends $.BootstrapTable {
 
     if (columnsCookie) {
       for (const column of this.columns) {
-        column.visible = columnsCookie.filter((columnField) => { return columnField === column.field }).length > 0 || !column.switchable
+        column.visible = columnsCookie.filter((columnField) => {
+          /**
+           * This is needed for the old saved cookies or the table will show no columns!
+           * It can be removed in 2-3 Versions Later!!
+           * TODO: Remove this part some versions later e.g. 1.17.3
+           */
+          if (columnField instanceof Object) {
+            return columnField.field === column.field
+          }
+
+          return columnField === column.field
+        }).length > 0 || !column.switchable
       }
     }
   }