mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2025-10-16 11:55:39 +00:00
fix #541
This commit is contained in:
parent
d4fa9a84e3
commit
0cdf086d56
@ -17,6 +17,7 @@ class ToolkitProvider extends statelessDrcorator(React.Component) {
|
||||
search: PropTypes.oneOfType([
|
||||
PropTypes.bool,
|
||||
PropTypes.shape({
|
||||
defaultSearch: PropTypes.string,
|
||||
searchFormatted: PropTypes.bool
|
||||
})
|
||||
]),
|
||||
@ -42,7 +43,7 @@ class ToolkitProvider extends statelessDrcorator(React.Component) {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
searchText: ''
|
||||
searchText: typeof props.search === 'object' ? (props.search.defaultSearch || '') : ''
|
||||
};
|
||||
this._ = null;
|
||||
this.onSearch = this.onSearch.bind(this);
|
||||
@ -85,6 +86,7 @@ class ToolkitProvider extends statelessDrcorator(React.Component) {
|
||||
return (
|
||||
<ToolkitContext.Provider value={ {
|
||||
searchProps: {
|
||||
searchText: this.state.searchText,
|
||||
onSearch: this.onSearch
|
||||
},
|
||||
csvProps: {
|
||||
|
||||
@ -47,6 +47,7 @@ const SearchBar = ({
|
||||
style={ style }
|
||||
onKeyUp={ () => debounceCallback() }
|
||||
className={ `form-control ${className}` }
|
||||
defaultValue={ searchText }
|
||||
placeholder={ placeholder || SearchBar.defaultProps.placeholder }
|
||||
{ ...rest }
|
||||
/>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user