浏览代码

force-multiple-sort event replaced with multipleSort method

Alexander Savchenko 9 年之前
父节点
当前提交
6a770e80da
共有 1 个文件被更改,包括 9 次插入6 次删除
  1. 9 6
      src/extensions/multiple-sort/bootstrap-table-multiple-sort.js

+ 9 - 6
src/extensions/multiple-sort/bootstrap-table-multiple-sort.js

@@ -161,6 +161,8 @@
         }
     };
 
+    $.fn.bootstrapTable.methods.push('multipleSort');
+
     $.extend($.fn.bootstrapTable.defaults, {
         showMultiSort: false,
         showMultiSortButton: true,
@@ -263,12 +265,6 @@
                 }
             });
 
-            this.$el.on('force-multiple-sort.bs.table', function() {
-                if (!isSingleSort && that.options.sortPriority !== null && typeof that.options.sortPriority === 'object' && that.options.sidePagination !== 'server') {
-                    that.onMultipleSort();
-                }
-            });
-
             this.$el.on('column-switch.bs.table', function(field, checked) {
                 for (var i = 0; i < that.options.sortPriority.length; i++) {
                     if (that.options.sortPriority[i].sortName === checked) {
@@ -289,6 +285,13 @@
         }
     };
 
+    BootstrapTable.prototype.multipleSort = function() {
+        var that = this;
+        if (!isSingleSort && that.options.sortPriority !== null && typeof that.options.sortPriority === 'object' && that.options.sidePagination !== 'server') {
+            that.onMultipleSort();
+        }
+    };
+
     BootstrapTable.prototype.onMultipleSort = function() {
         var that = this;