Browse Source

Merge branch 'develop' into fix/5868

文翼 4 years ago
parent
commit
4832531cdc

+ 12 - 0
site/docs/api/events.md

@@ -348,6 +348,18 @@ $('#table').on('event-name.bs.table', function (e, arg1, arg2, ...) {
 
 
   * `cardView`: the cardView state of the table.
   * `cardView`: the cardView state of the table.
 
 
+## onTogglePagination
+
+- **jQuery Event:** `toggle-pagination.bs.table`
+
+- **Parameter:** `state`
+
+- **Detail:**
+
+  Fires when the pagination was toggled:
+
+  * `state`: the new pagination state (`true`-> Pagination is enabled, `false` -> Pagination is disabled )
+
 ## onUncheck
 ## onUncheck
 
 
 - **jQuery Event:** `uncheck.bs.table`
 - **jQuery Event:** `uncheck.bs.table`

+ 1 - 0
src/bootstrap-table.js

@@ -3080,6 +3080,7 @@ class BootstrapTable {
     this.$toolbar.find('button[name="paginationSwitch"]')
     this.$toolbar.find('button[name="paginationSwitch"]')
       .html(`${Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon) } ${ text}`)
       .html(`${Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon) } ${ text}`)
     this.updatePagination()
     this.updatePagination()
+    this.trigger('toggle-pagination', this.options.pagination)
   }
   }
 
 
   toggleFullscreen () {
   toggleFullscreen () {

+ 5 - 1
src/constants/index.js

@@ -394,6 +394,9 @@ const DEFAULTS = {
   },
   },
   onScrollBody () {
   onScrollBody () {
     return false
     return false
+  },
+  onTogglePagination (newState) {
+    return false
   }
   }
 }
 }
 
 
@@ -564,7 +567,8 @@ const EVENTS = {
   'refresh-options.bs.table': 'onRefreshOptions',
   'refresh-options.bs.table': 'onRefreshOptions',
   'reset-view.bs.table': 'onResetView',
   'reset-view.bs.table': 'onResetView',
   'refresh.bs.table': 'onRefresh',
   'refresh.bs.table': 'onRefresh',
-  'scroll-body.bs.table': 'onScrollBody'
+  'scroll-body.bs.table': 'onScrollBody',
+  'toggle-pagination.bs.table': 'onTogglePagination'
 }
 }
 
 
 Object.assign(DEFAULTS, EN)
 Object.assign(DEFAULTS, EN)

+ 1 - 1
src/extensions/group-by-v2/bootstrap-table-group-by.js

@@ -105,7 +105,7 @@ BootstrapTable.prototype.initSort = function (...args) {
         }
         }
 
 
         if (this.isCollapsed(key, value)) {
         if (this.isCollapsed(key, value)) {
-          item._class = 'hidden'
+          item._class += ' hidden'
         }
         }
 
 
         item._data['parent-index'] = index
         item._data['parent-index'] = index