reactjs - How to clear material ui autocomplete selected values on button click in react js? -
i want clear material ui autocomplete selected values on click on reset button ? making state empty. still not happening.can suggest how achieve this? below code.
import autocomplete 'material-ui/autocomplete'; import raisedbutton 'material-ui/raisedbutton'; const providers = ['aaa', 'aaaaa', 'bbb', 'bbbbb', 'ccc', 'ddd']; export default class physiciandetails extends react.component { constructor(props) { super(props); this.state = {provider:''} } this.providerchange = this.providerchange.bind(this); this.handlereset = this.handlereset.bind(this); providerchange(value) {debugger; this.setstate({ provider:value }); } handlereset() { this.setstate({provider:''}); } render() { return( <div> <autocomplete floatinglabeltext='providers' filter={autocomplete.caseinsensitivefilter} onupdateinput={this.providerchange} datasource={providers} /> <raisedbutton label='reset' onclick={this.handlereset} /> </div> )} }
Comments
Post a Comment