Skip to content

Commit

Permalink
fix #848
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed Nov 30, 2016
1 parent 1452f7a commit f7646dc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/BootstrapTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,11 @@ class BootstrapTable extends Component {
}

handleSearch = searchText => {
// Set search field if this function being called outside
// but it's not necessary if calling fron inside.
if (this.refs.toolbar) {
this.refs.toolbar.setSearchInput(searchText);
}
const { onSearchChange } = this.props.options;
if (onSearchChange) {
const colInfos = this.store.getColInfos();
Expand Down Expand Up @@ -858,6 +863,7 @@ class BootstrapTable extends Component {
return (
<div className='react-bs-table-tool-bar'>
<ToolBar
ref='toolbar'
defaultSearch={ this.props.options.defaultSearch }
clearSearch={ this.props.options.clearSearch }
searchDelayTime={ this.props.options.searchDelayTime }
Expand Down
6 changes: 6 additions & 0 deletions src/toolbar/ToolBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ class ToolBar extends Component {
this.clearTimeout();
}

setSearchInput(text) {
if (this.refs.seachInput.value !== text) {
this.refs.seachInput.value = text;
}
}

clearTimeout() {
if (this.timeouteClear) {
clearTimeout(this.timeouteClear);
Expand Down

0 comments on commit f7646dc

Please sign in to comment.