Browse Source

Update bootstrap-table-multiple-sort.js

Fix exception interaction with hide/show columns prior to multisort if no sortPriority exists
Alli 4 years ago
parent
commit
9bfdfc1bb8
1 changed files with 8 additions and 5 deletions
  1. 8 5
      src/extensions/multiple-sort/bootstrap-table-multiple-sort.js

+ 8 - 5
src/extensions/multiple-sort/bootstrap-table-multiple-sort.js

@@ -656,13 +656,16 @@ BootstrapTable.prototype.initToolbar = function (...args) {
     })
     })
 
 
     this.$el.on('column-switch.bs.table', (field, checked) => {
     this.$el.on('column-switch.bs.table', (field, checked) => {
-      for (let i = 0; i < that.options.sortPriority.length; i++) {
-        if (that.options.sortPriority[i].sortName === checked) {
-          that.options.sortPriority.splice(i, 1)
+      if (that.options.sortPriority !== null && that.options.sortPriority.length > 0) {
+        for (let i = 0; i < that.options.sortPriority.length; i++) {
+          if (that.options.sortPriority[i].sortName === checked) {
+            that.options.sortPriority.splice(i, 1)
+          }
         }
         }
-      }
 
 
-      that.assignSortableArrows()
+        that.assignSortableArrows()
+      }
+      
       that.$sortModal.remove()
       that.$sortModal.remove()
       showSortModal(that)
       showSortModal(that)
     })
     })