浏览代码

Fixed multiple-sort cannot work bug (#5495)

文翼 5 年之前
父节点
当前提交
518ff706a2
共有 2 个文件被更改,包括 3 次插入0 次删除
  1. 1 0
      src/bootstrap-table.js
  2. 2 0
      src/extensions/multiple-sort/bootstrap-table-multiple-sort.js

+ 1 - 0
src/bootstrap-table.js

@@ -2320,6 +2320,7 @@ class BootstrapTable {
         this.searchText ||
         this.options.customSearch ||
         this.options.sortName !== undefined ||
+        this.enableCustomSort || // Fix #4616: this.enableCustomSort is for extensions
         !Utils.isEmptyObject(this.filterColumns) ||
         !Utils.isEmptyObject(this.filterColumnsPartial)
       ) && (!params || !params.unfiltered)

+ 2 - 0
src/extensions/multiple-sort/bootstrap-table-multiple-sort.js

@@ -679,6 +679,7 @@ BootstrapTable.prototype.destroy = function (...args) {
   _destroy.apply(this, Array.prototype.slice.apply(args))
 
   if (this.options.showMultiSort) {
+    this.enableCustomSort = false
     this.$sortModal.remove()
   }
 }
@@ -744,6 +745,7 @@ BootstrapTable.prototype.onMultipleSort = function () {
     return cmp(arr1, arr2)
   }
 
+  this.enableCustomSort = true
   this.data.sort((a, b) => arrayCmp(a, b))
 
   this.initBody()