Skip to content

Commit

Permalink
Merge pull request #810 from oeph/filter-change-pr
Browse files Browse the repository at this point in the history
Fixes handler binding for dynamic generated columns
  • Loading branch information
AllenFang authored Nov 2, 2016
2 parents 32b9504 + bf968f7 commit e1f287a
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 e1f287a

Please sign in to comment.