ソースを参照

Added checkInvert method, that inverts current selections

Real-Gecko 10 年 前
コミット
98839b3f34
1 ファイル変更14 行追加0 行削除
  1. 14 0
      src/bootstrap-table.js

+ 14 - 0
src/bootstrap-table.js

@@ -2439,6 +2439,20 @@
         this.checkAll_(false);
     };
 
+    BootstrapTable.prototype.checkInvert = function () {
+        var that = this;
+        var rows = that.$selectItem.filter(':enabled');
+        var checked = rows.filter(':checked');
+        rows.each(function() {
+            $(this).prop('checked', !$(this).prop('checked'));
+        });
+        that.updateRows();
+        that.updateSelected();
+        that.trigger('uncheck-some', checked);
+        checked = that.getSelections();
+        that.trigger('check-some', checked);
+    };
+
     BootstrapTable.prototype.checkAll_ = function (checked) {
         var rows;
         if (!checked) {