Skip to content

Commit 1741487

Browse files
committed
fix #1816
1 parent 8b28c4b commit 1741487

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/TableHeaderColumn.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class TableHeaderColumn extends Component {
3030
const filter = currentFilter[nextProps.dataField];
3131
const value = filter ? filter.value : '';
3232

33-
const { ref } = this.getFilters() || {};
33+
const { ref } = this.getFilters(nextProps) || {};
3434
if (this.refs[ref]) {
3535
this.refs[ref].setState({ value });
3636
}
@@ -50,42 +50,42 @@ class TableHeaderColumn extends Component {
5050
filter.emitter.handleFilter(this.props.dataField, value, type, filter);
5151
}
5252

53-
getFilters() {
54-
const { headerText, children } = this.props;
55-
switch (this.props.filter.type) {
53+
getFilters(props = this.props) {
54+
const { headerText, children } = props;
55+
switch (props.filter.type) {
5656
case Const.FILTER_TYPE.TEXT: {
5757
return (
58-
<TextFilter ref={ n => this.textFilter = n } { ...this.props.filter }
58+
<TextFilter ref={ n => this.textFilter = n } { ...props.filter }
5959
columnName={ headerText || children } filterHandler={ this.handleFilter } />
6060
);
6161
}
6262
case Const.FILTER_TYPE.REGEX: {
6363
return (
64-
<RegexFilter ref={ n => this.regexFilter = n } { ...this.props.filter }
64+
<RegexFilter ref={ n => this.regexFilter = n } { ...props.filter }
6565
columnName={ headerText || children } filterHandler={ this.handleFilter } />
6666
);
6767
}
6868
case Const.FILTER_TYPE.SELECT: {
6969
return (
70-
<SelectFilter ref={ n => this.selectFilter = n } { ...this.props.filter }
70+
<SelectFilter ref={ n => this.selectFilter = n } { ...props.filter }
7171
columnName={ headerText || children } filterHandler={ this.handleFilter } />
7272
);
7373
}
7474
case Const.FILTER_TYPE.NUMBER: {
7575
return (
76-
<NumberFilter ref={ n => this.numberFilter = n } { ...this.props.filter }
76+
<NumberFilter ref={ n => this.numberFilter = n } { ...props.filter }
7777
columnName={ headerText || children } filterHandler={ this.handleFilter } />
7878
);
7979
}
8080
case Const.FILTER_TYPE.DATE: {
8181
return (
82-
<DateFilter ref={ n => this.dateFilter = n } { ...this.props.filter }
82+
<DateFilter ref={ n => this.dateFilter = n } { ...props.filter }
8383
columnName={ headerText || children } filterHandler={ this.handleFilter } />
8484
);
8585
}
8686
case Const.FILTER_TYPE.CUSTOM: {
87-
const elm = this.props.filter.getElement(this.handleFilter,
88-
this.props.filter.customFilterParameters);
87+
const elm = props.filter.getElement(this.handleFilter,
88+
props.filter.customFilterParameters);
8989

9090
return React.cloneElement(elm, { ref: n => this.customFilter = n });
9191
}

0 commit comments

Comments
 (0)