浏览代码

Fix #1326: btSelectAll can't be unchecked if table is empty bug.

zhixin 10 年之前
父节点
当前提交
ffeb474e14
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      src/bootstrap-table.js

+ 3 - 2
src/bootstrap-table.js

@@ -1729,7 +1729,8 @@
     };
 
     BootstrapTable.prototype.updateSelected = function () {
-        var checkAll = this.$selectItem.filter(':enabled').length ===
+        var checkAll = this.$selectItem.filter(':enabled').length &&
+            this.$selectItem.filter(':enabled').length ===
             this.$selectItem.filter(':enabled').filter(':checked').length;
 
         this.$selectAll.add(this.$selectAll_).prop('checked', checkAll);
@@ -2247,9 +2248,9 @@
         if (!checked) {
             rows = this.getSelections();
         }
+        this.$selectAll.add(this.$selectAll_).prop('checked', checked);
         this.$selectItem.filter(':enabled').prop('checked', checked);
         this.updateRows();
-        this.updateSelected();
         if (checked) {
             rows = this.getSelections();
         }