question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dropdown options update triggered by onSearchChange

See original GitHub issue

In my dropdown module, the options consist of a list of users which are fetched remotely and based on the search value of the dropdown.

<Form.Field
  allowAdditions
  control={Dropdown}
  loading={this.props.loading}
  onSearchChange={this.onSearchChange.bind(this)}
  options={this.state.users}
  placeholder="Select user"
  search
  selection
/>

When some characters are rendered in the seach field, the dropdown options should display the fetched results.

Strangely, this works when there is only one result. When there are more, no results are shown. I do see the options correctly shown in as <options> in the <select> node, but the corresponding <DropdownItem> are not rendered. Logging the results in the console also shows them. When I blur the search box and focus it again, the results are all there. So it seems like the dropdown options don’t update when there is more than 1 result.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
dackers86commented, Mar 28, 2017

@jhartma Would it be possible to explain how you fixed your solution?

I am experiencing the same problem, the options will only update after a fetch once the I have clicked off screen…?

  <Dropdown
    allowAdditions
    options={this.state.addressOptions}
    placeholder='Please enter your address'
    search
    selection
    fluid
    onChange={this.handleChange}
    onSearchChange={this.handleSearchChange.bind(this)}
  />
1reaction
jhartmacommented, Jan 30, 2017

Okay I got it working, I close the issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use onChange method in semantic react dropdown
You can use onSearchChange with same parameters. (I've updated the example) ... use onChange event to detect the changes in the dropdown list...
Read more >
Dropdown
A dropdown's options can be controlled from outside based on search change. Try it CodeSandboxMaximizePermalink. Fetch Random Search
Read more >
Step 7: Creating the user search
This step will focus on getting the user search working with the Achievers user API. You will use the Dropdown component from the...
Read more >
Select
Select component allows user to pick one option from the given data ... Set searchValue and onSearchChange prop to enable controlled search in...
Read more >
Mention
This plugin allows the user to choose an entry from a list. ... onSearchChangeA callback which is triggered whenever the search term changes....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found