Browse Source

Fix bug: check all does not work in some case.

zhixin 11 years ago
parent
commit
ef277186d3
2 changed files with 8 additions and 7 deletions
  1. 1 1
      README.md
  2. 7 6
      src/bootstrap-table.js

+ 1 - 1
README.md

@@ -21,7 +21,7 @@ Bootstrap table displays data in a tabular format and offers rich support to rad
 - [x] Fix #102: Wrong `options.columns` initialization.
 - [x] Fix #121: Add extensions for bootstrap table.
 - [x] Fix #138: IE8 search data and remove method error.
-- [x] Fix bug: sorter does not work in some case.
+- [x] Fix bug: sorter and check all do not work in some case.
 - [x] Add `bootstrap-table-nl-NL.js` and `bootstrap-table-el-GR.js`.
 - [x] Support search without data-field set, trim search input.
 - [x] Fix #81: Allow the `class` to be applied to the radio or checkbox row.

+ 7 - 6
src/bootstrap-table.js

@@ -390,10 +390,11 @@
         }
 
         this.$selectAll = this.$header.find('[name="btSelectAll"]');
-        this.$selectAll.off('click').on('click', function () {
-            var checked = $(this).prop('checked');
-            that[checked ? 'checkAll' : 'uncheckAll']();
-        });
+        this.$container.off('click', '[name="btSelectAll"]')
+            .on('click', '[name="btSelectAll"]', function () {
+                var checked = $(this).prop('checked');
+                that[checked ? 'checkAll' : 'uncheckAll']();
+            });
     };
 
     BootstrapTable.prototype.initData = function (data, append) {
@@ -1284,7 +1285,7 @@
 
     BootstrapTable.prototype.checkAll = function () {
         this.$selectAll.add(this.$selectAll_).prop('checked', true);
-        this.$selectItem.prop('checked', true);
+        this.$selectItem.filter(':enabled').prop('checked', true);
         this.updateRows(true);
         this.updateSelected();
         this.trigger('check-all');
@@ -1292,7 +1293,7 @@
 
     BootstrapTable.prototype.uncheckAll = function () {
         this.$selectAll.add(this.$selectAll_).prop('checked', false);
-        this.$selectItem.prop('checked', false);
+        this.$selectItem.filter(':enabled').prop('checked', false);
         this.updateRows(false);
         this.updateSelected();
         this.trigger('uncheck-all');