Skip to content

Commit

Permalink
Merge pull request #6083 from wenzhixin/feature/6057
Browse files Browse the repository at this point in the history
Feature/6057
  • Loading branch information
UtechtDustin authored Mar 14, 2022
2 parents 5449f35 + 6c74fbe commit 390d6dd
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ interface BootstrapTableEvents{
'all.bs.table': string;
'uncheck-all.bs.table': string;
'column-switch.bs.table': string;
'column-switch-all.bs.table': string;
'check.bs.table': string;
'search.bs.table': string;
'load-success.bs.table': string;
Expand Down
12 changes: 12 additions & 0 deletions site/docs/api/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,18 @@ $('#table').on('event-name.bs.table', function (e, arg1, arg2, ...) {
* `field`: the field name corresponding to the switch column.
* `checked`: the checked state of the column.

## onColumnSwitchAll

- **jQuery Event:** `column-switch-all.bs.table`

- **Parameter:** `checked`

- **Detail:**

It fires when toogle all columns. The parameters contain:

* `checked`: the checked state of the column.

## onDblClickCell

- **jQuery Event:** `dbl-click-cell.bs.table`
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,7 @@ class BootstrapTable {

$toggleAll.off('click').on('click', ({ currentTarget }) => {
this._toggleAllColumns($(currentTarget).prop('checked'))
this.trigger('column-switch-all', $(currentTarget).prop('checked'))
})

if (opts.showColumnsSearch) {
Expand Down
4 changes: 4 additions & 0 deletions src/constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@ const DEFAULTS = {
onColumnSwitch (field, checked) {
return false
},
onColumnSwitchAll (checked) {
return false
},
onPageChange (number, size) {
return false
},
Expand Down Expand Up @@ -498,6 +501,7 @@ const EVENTS = {
'load-success.bs.table': 'onLoadSuccess',
'load-error.bs.table': 'onLoadError',
'column-switch.bs.table': 'onColumnSwitch',
'column-switch-all.bs.table': 'onColumnSwitchAll',
'page-change.bs.table': 'onPageChange',
'search.bs.table': 'onSearch',
'toggle.bs.table': 'onToggle',
Expand Down

0 comments on commit 390d6dd

Please sign in to comment.