Skip to content

Commit

Permalink
Added toggleable backspace removes options to Github demo for Async
Browse files Browse the repository at this point in the history
  • Loading branch information
bvaughn committed Sep 18, 2016
1 parent f822236 commit c50e47c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion examples/src/components/GithubUsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const GithubUsers = React.createClass({
},
getInitialState () {
return {
backspaceRemoves: true,
multi: true
};
},
Expand Down Expand Up @@ -44,6 +45,11 @@ const GithubUsers = React.createClass({
gotoUser (value, event) {
window.open(value.html_url);
},
toggleBackspaceRemoves () {
this.setState({
backspaceRemoves: !this.state.backspaceRemoves
});
},
toggleCreatable () {
this.setState({
creatable: !this.state.creatable
Expand All @@ -57,7 +63,7 @@ const GithubUsers = React.createClass({
return (
<div className="section">
<h3 className="section-heading">{this.props.label}</h3>
<AsyncComponent multi={this.state.multi} value={this.state.value} onChange={this.onChange} onValueClick={this.gotoUser} valueKey="id" labelKey="login" loadOptions={this.getUsers} backspaceRemoves={false} />
<AsyncComponent multi={this.state.multi} value={this.state.value} onChange={this.onChange} onValueClick={this.gotoUser} valueKey="id" labelKey="login" loadOptions={this.getUsers} backspaceRemoves={this.state.backspaceRemoves} />
<div className="checkbox-list">
<label className="checkbox">
<input type="radio" className="checkbox-control" checked={this.state.multi} onChange={this.switchToMulti}/>
Expand All @@ -73,6 +79,10 @@ const GithubUsers = React.createClass({
<input type="checkbox" className="checkbox-control" checked={this.state.creatable} onChange={this.toggleCreatable} />
<span className="checkbox-label">Creatable?</span>
</label>
<label className="checkbox">
<input type="checkbox" className="checkbox-control" checked={this.state.backspaceRemoves} onChange={this.toggleBackspaceRemoves} />
<span className="checkbox-label">Backspace Removes?</span>
</label>
</div>
<div className="hint">This example uses fetch.js for showing Async options with Promises</div>
</div>
Expand Down

0 comments on commit c50e47c

Please sign in to comment.