Skip to content

Commit ea867d2

Browse files
authored
Merge pull request #1341 from react-bootstrap-table/develop
20200418 release
2 parents 9ca4333 + 54df96c commit ea867d2

File tree

7 files changed

+47
-5
lines changed

7 files changed

+47
-5
lines changed

docs/columns.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ You can assign any [HTML Event](https://www.w3schools.com/tags/ref_eventattribut
437437
* onMouseEnter
438438
* onMouseLeave
439439
* onContextMenu
440+
* onAuxClick
440441

441442
```js
442443
{

packages/react-bootstrap-table2-example/examples/column-filter/filter-hooks.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,26 @@ const columns = [{
4141
})
4242
}];
4343
44-
<BootstrapTable keyField='id' data={ products } columns={ columns } filter={ filterFactory() } />
44+
function afterFilter(newResult, newFilters) {
45+
console.log(newResult);
46+
console.log(newFilters);
47+
}
48+
49+
<BootstrapTable keyField='id' data={ products } columns={ columns } filter={ filterFactory({ afterFilter }) } />
4550
`;
4651

52+
function afterFilter(newResult, newFilters) {
53+
console.log(newResult);
54+
console.log(newFilters);
55+
}
56+
4757
export default () => (
4858
<div>
4959
<BootstrapTable
5060
keyField="id"
5161
data={ products }
5262
columns={ columns }
53-
filter={ filterFactory() }
63+
filter={ filterFactory({ afterFilter }) }
5464
/>
5565
<Code>{ sourceCode }</Code>
5666
</div>

packages/react-bootstrap-table2-filter/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,3 +361,28 @@ Default filter is rendered inside the table column header, but you can choose to
361361
filterPosition="bottom"
362362
/>
363363
```
364+
365+
## Configuration
366+
367+
`filterFactory` is a factory function for initializing some internal config. Below is available options for `filterFactory`:
368+
369+
### afterFilter
370+
This hook function will be called with two arguments(new filter result and filter object) when filtering completed.
371+
372+
```js
373+
function afterFilter(newResult, newFilters) {
374+
console.log(newResult);
375+
console.log(newFilters);
376+
}
377+
378+
export default () => (
379+
<div>
380+
<BootstrapTable
381+
keyField="id"
382+
data={ products }
383+
columns={ columns }
384+
filter={ filterFactory({ afterFilter }) }
385+
/>
386+
</div>
387+
);
388+
```

packages/react-bootstrap-table2-filter/src/context.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,11 @@ export default (
9595
}
9696

9797
doFilter(props, ignoreEmitDataChange = false) {
98-
const { dataChangeListener, data, columns } = props;
98+
const { dataChangeListener, data, columns, filter } = props;
9999
const result = filters(data, columns, _)(this.currFilters, this.clearFilters);
100+
if (filter.afterFilter) {
101+
filter.afterFilter(result, this.currFilters);
102+
}
100103
this.data = result;
101104
if (dataChangeListener && !ignoreEmitDataChange) {
102105
this.isEmitDataChange = true;

packages/react-bootstrap-table2/src/cell-event-delegater.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ const events = [
55
'onDoubleClick',
66
'onMouseEnter',
77
'onMouseLeave',
8-
'onContextMenu'
8+
'onContextMenu',
9+
'onAuxClick'
910
];
1011

1112
export default ExtendBase =>

packages/react-bootstrap-table2/src/contexts/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ const withContext = Base =>
302302
{ ...baseProps }
303303
ref={ n => this.filterContext = n }
304304
data={ rootProps.getData() }
305+
filter={ this.props.filter.options || {} }
305306
dataChangeListener={ this.props.dataChangeListener }
306307
>
307308
<this.FilterContext.Consumer>

packages/react-bootstrap-table2/src/row/event-delegater.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ const events = [
66
'onDoubleClick',
77
'onMouseEnter',
88
'onMouseLeave',
9-
'onContextMenu'
9+
'onContextMenu',
10+
'onAuxClick'
1011
];
1112

1213
export default ExtendBase =>

0 commit comments

Comments
 (0)