Skip to content

Commit

Permalink
Handle no values
Browse files Browse the repository at this point in the history
  • Loading branch information
soyjavi committed Jun 26, 2015
1 parent 1521434 commit 70418aa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions components/autocomplete/index.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ module.exports = React.createClass
else
Object.keys(@state.values)?[0]

setValue: (data) ->
data = [data] if typeof data is 'string'
setValue: (data = []) ->
values = {}
values[key] = label for key, label of @state.dataSource when key in data
data = [data] if typeof data is 'string'
values[key] = label for key, label of @state?.dataSource when key in data
@state.values = values
@setState values: values
@refs.input.setValue values[Object.keys(values)?[0]] unless @props.multiple
Expand Down

0 comments on commit 70418aa

Please sign in to comment.