Browse Source

Fixed toggle all columns error when column switchable is false.

zhixin 3 years ago
parent
commit
f93177d52a
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/bootstrap-table.js

+ 5 - 1
src/bootstrap-table.js

@@ -2796,7 +2796,11 @@ class BootstrapTable {
   _toggleAllColumns (visible) {
   _toggleAllColumns (visible) {
     for (const column of this.columns.slice().reverse()) {
     for (const column of this.columns.slice().reverse()) {
       if (column.switchable) {
       if (column.switchable) {
-        if (!visible && this.options.showColumns && this.getVisibleColumns().length === this.options.minimumCountColumns) {
+        if (
+          !visible &&
+          this.options.showColumns &&
+          this.getVisibleColumns().filter(it => it.switchable).length === this.options.minimumCountColumns
+        ) {
           continue
           continue
         }
         }
         column.visible = visible
         column.visible = visible