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([
|
search: PropTypes.oneOfType([
|
||||||
PropTypes.bool,
|
PropTypes.bool,
|
||||||
PropTypes.shape({
|
PropTypes.shape({
|
||||||
|
defaultSearch: PropTypes.string,
|
||||||
searchFormatted: PropTypes.bool
|
searchFormatted: PropTypes.bool
|
||||||
})
|
})
|
||||||
]),
|
]),
|
||||||
@ -42,7 +43,7 @@ class ToolkitProvider extends statelessDrcorator(React.Component) {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
searchText: ''
|
searchText: typeof props.search === 'object' ? (props.search.defaultSearch || '') : ''
|
||||||
};
|
};
|
||||||
this._ = null;
|
this._ = null;
|
||||||
this.onSearch = this.onSearch.bind(this);
|
this.onSearch = this.onSearch.bind(this);
|
||||||
@ -85,6 +86,7 @@ class ToolkitProvider extends statelessDrcorator(React.Component) {
|
|||||||
return (
|
return (
|
||||||
<ToolkitContext.Provider value={ {
|
<ToolkitContext.Provider value={ {
|
||||||
searchProps: {
|
searchProps: {
|
||||||
|
searchText: this.state.searchText,
|
||||||
onSearch: this.onSearch
|
onSearch: this.onSearch
|
||||||
},
|
},
|
||||||
csvProps: {
|
csvProps: {
|
||||||
|
|||||||
@ -47,6 +47,7 @@ const SearchBar = ({
|
|||||||
style={ style }
|
style={ style }
|
||||||
onKeyUp={ () => debounceCallback() }
|
onKeyUp={ () => debounceCallback() }
|
||||||
className={ `form-control ${className}` }
|
className={ `form-control ${className}` }
|
||||||
|
defaultValue={ searchText }
|
||||||
placeholder={ placeholder || SearchBar.defaultProps.placeholder }
|
placeholder={ placeholder || SearchBar.defaultProps.placeholder }
|
||||||
{ ...rest }
|
{ ...rest }
|
||||||
/>
|
/>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user