-
Notifications
You must be signed in to change notification settings - Fork 2
Search Filter
brandonk1234 edited this page Feb 23, 2017
·
2 revisions
The searchFilter can be used for searching specific items and then using the button on the left hand side to filter down your results.
The props needed for this component are listed and explained below:
-
placeholder
- This prop must be atext
-
onChange
- This prop must be afunction
-
filter
- This prop must be astring
-
value
- This prop must be astring
-
shouldFocusInput
- This prop must be aboolean
-
onFilterChanged
- This prop must be afunction
-
filters
- This prop must be aarray
ofobjects
with the given keys shown in the example.
<SearchFilter
placeholder="enter text here"
onChange={this.onChange}
filter={this.state.filter}
value={this.state.value}
shouldFocusInput={false}
onFilterChanged={this.onFilterChanged}
filters={[
{
text: 'Filter 1',
_value: 'Filter 1'
},
{
text: 'Filter 2',
_value: 'Filter 2'
},
{
text: 'Filter 3',
_value: 'Filter 3'
}
]}
/>
// ...React Component
getInitialState: function() {
return {
searchValue: "",
filter: ""
}
},
onChange: function(value) {
this.setState({
searchValue: value
})
},
onFilterChanged: function(value) {
this.setState({
filter: value
})
},