Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation about defaultValue and allowCustomValues #73

Open
franleplant opened this issue May 8, 2015 · 8 comments
Open

Documentation about defaultValue and allowCustomValues #73

franleplant opened this issue May 8, 2015 · 8 comments
Labels

Comments

@franleplant
Copy link
Contributor

Hi!
What is the function of these? Are included in the latest release?
I've tested defaultValue and it is not working on 1.0.4.

Any quick ideas about them?

Thanks!
Fran

@thehuey
Copy link
Contributor

thehuey commented May 8, 2015

I think defaultValue serves to have the tokenizer check and display values
that partially match. It makes the TypeAheadSelector display if you have
matching values in the options array.

On Fri, May 8, 2015 at 3:40 PM, Francisco Guijarro <[email protected]

wrote:

Hi!
What is the function of these? Are included in the latest release?
I've tested defaultValue and it is not working on 1.0.4.

Any quick ideas about them?

Thanks!
Fran


Reply to this email directly or view it on GitHub
#73.

@franleplant
Copy link
Contributor Author

With string literals it works:

defaultValue="something"

but with bindings it does not

defaultValue={this.state.someVar}

@fmoo
Copy link
Owner

fmoo commented May 9, 2015

but with bindings it does not

defaultValue={this.state.someVar}

Is this.state.someVar set to a string? That should be working. Are you getting an error message?

@franleplant
Copy link
Contributor Author

@fmoo no error message, just nothing is displayed on the input inside the typeahead

Originally someVar has nothing and after a couple of seconds it gets a string value.

This does not work either:

{"some string"}

@fmoo
Copy link
Owner

fmoo commented Jun 13, 2015

This is really strange. Were you using the latest version of react everywhere in your project?

@danielsoner
Copy link

Hi, I use React 0.14.0-alpha3 and I have the same exact problem.

@jprogertest
Copy link

The same here with React 0.13.3.
A basic workaround that partially works for me :
<Input type='text' id='ShortName' placeholder='Enter short name' defaultValue={${this.state.ShortName}} />
But it does not refresh the value when
setState({ShortName: 'toto'}) is called in success of an ajax call.
Any idea ?

@kitdesai
Copy link

having this same issue:

defaultValue={selectedCity} doesn't work for me but defaultValue="asdf" does. also weird is that placeholder={selectedCity} works correctly but with bindings defaultValue (and value) do not

EDIT: @fmoo, figured out the issue. this.props.entryValue is what's being passed to the input element's value attribute, but that's set in getInitialState(), which won't get overridden if the typeahead component is re-rendered with an updated value or defaultValue.

the issue is being addressed here: #133

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants