Browse Source

return rows before and after (un)check all

Dustin Utecht 6 years ago
parent
commit
6ce3615788
1 changed files with 7 additions and 6 deletions
  1. 7 6
      src/bootstrap-table.js

+ 7 - 6
src/bootstrap-table.js

@@ -2377,17 +2377,18 @@ class BootstrapTable {
   }
 
   checkAll_ (checked) {
-    let rows
-    if (!checked) {
-      rows = this.getSelections()
-    }
+    const rowsBefore = this.getSelections()
     this.$selectAll.add(this.$selectAll_).prop('checked', checked)
     this.$selectItem.filter(':enabled').prop('checked', checked)
     this.updateRows()
+
+    const rowsAfter = this.getSelections()
     if (checked) {
-      rows = this.getSelections()
+      this.trigger('check-all', rowsAfter, rowsBefore)
+      return
     }
-    this.trigger(checked ? 'check-all' : 'uncheck-all', rows)
+
+    this.trigger('uncheck-all', rowsAfter, rowsBefore)
   }
 
   check (index) {