Skip to content

Commit

Permalink
Fixes onFilterChange Handler binding for dynamic generated columns (f…
Browse files Browse the repository at this point in the history
…ixes #614)
  • Loading branch information
Philipp Oehme committed Oct 19, 2016
1 parent 43a12b5 commit bf968f7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/BootstrapTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ class BootstrapTable extends Component {

this.initTable(this.props);

if (this.filter) {
this.filter.on('onFilterChange', (currentFilter) => {
this.handleFilterData(currentFilter);
});
}

if (this.props.selectRow && this.props.selectRow.selected) {
const copy = this.props.selectRow.selected.slice();
this.store.setSelectedRowKey(copy);
Expand Down Expand Up @@ -73,6 +67,13 @@ class BootstrapTable extends Component {
column.props.filter.emitter = this.filter;
}
});

if (this.filter) {
this.filter.removeAllListeners('onFilterChange');
this.filter.on('onFilterChange', (currentFilter) => {
this.handleFilterData(currentFilter);
});
}

this.colInfos = this.getColumnsDescription(props).reduce(( prev, curr ) => {
prev[curr.name] = curr;
Expand Down

0 comments on commit bf968f7

Please sign in to comment.