浏览代码

Fix condition to add levels in showSortModal

Fix condition for initial adding of rows inside showSortModal.
dimbslmh 10 年之前
父节点
当前提交
1eda790db6
共有 1 个文件被更改,包括 7 次插入7 次删除
  1. 7 7
      src/extensions/multiple-sort/bootstrap-table-multiple-sort.js

+ 7 - 7
src/extensions/multiple-sort/bootstrap-table-multiple-sort.js

@@ -21,10 +21,6 @@
         'YBSggaqGu5FA/BOIv2PBIPFEUgxjB+IdQPwfC94HxLykus4GiD+hGfQOiB3J8SojEE9EM2wuSJ' +
         'YBSggaqGu5FA/BOIv2PBIPFEUgxjB+IdQPwfC94HxLykus4GiD+hGfQOiB3J8SojEE9EM2wuSJ' +
         'zcsFMG4ttQgx4DsRalkZENxL+AuJQaMcsGxBOAmGvopk8AVz1sLZgg0bsAAAAASUVORK5CYII= ';
         'zcsFMG4ttQgx4DsRalkZENxL+AuJQaMcsGxBOAmGvopk8AVz1sLZgg0bsAAAAASUVORK5CYII= ';
 
 
-    var cmp = function(x, y) {
-        return x > y ? 1 : x < y ? -1 : 0;
-    };
-
     var showSortModal = function(that) {
     var showSortModal = function(that) {
         if (!$("#sortModal").hasClass("modal")) {
         if (!$("#sortModal").hasClass("modal")) {
             var sModal = '  <div class="modal fade" id="sortModal" tabindex="-1" role="dialog" aria-labelledby="sortModalLabel" aria-hidden="true">';
             var sModal = '  <div class="modal fade" id="sortModal" tabindex="-1" role="dialog" aria-labelledby="sortModalLabel" aria-hidden="true">';
@@ -142,10 +138,10 @@
                         sortName: that.options.sortName,
                         sortName: that.options.sortName,
                         sortOrder: that.options.sortOrder
                         sortOrder: that.options.sortOrder
                     }];
                     }];
-                } else {
-                    that.addLevel(0);
                 }
                 }
-            } else if ($rows.length < that.options.sortPriority.length && typeof that.options.sortPriority === 'object') {
+            }
+            
+            if ($rows.length < that.options.sortPriority.length && typeof that.options.sortPriority === 'object') {
                 for (var i = 0; i < that.options.sortPriority.length; i++) {
                 for (var i = 0; i < that.options.sortPriority.length; i++) {
                     that.addLevel(i, that.options.sortPriority[i]);
                     that.addLevel(i, that.options.sortPriority[i]);
                 }
                 }
@@ -260,6 +256,10 @@
 
 
     BootstrapTable.prototype.onMultipleSort = function() {
     BootstrapTable.prototype.onMultipleSort = function() {
         var that = this;
         var that = this;
+        
+        var cmp = function(x, y) {
+            return x > y ? 1 : x < y ? -1 : 0;
+        };
 
 
         var arrayCmp = function(a, b) {
         var arrayCmp = function(a, b) {
             var arr1 = [],
             var arr1 = [],