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

[Dropdown] Add "localsearch" Setting to allow local search when dropdown data retrieved from remote API #4815

Merged
merged 2 commits into from
Dec 27, 2016

Conversation

enix223
Copy link
Contributor

@enix223 enix223 commented Dec 7, 2016

Dropdown local search only happened with local data, and dropdown with remote api will search the data by continuous invoking API with query parameter.

Since for some scenarios, we just want to retrieve the data once from the server, and search the data locally. To support this requirement, I have enhanced the dropdown module to support local search when data is retrieved from remote API.

localSearch is default to false, so it will not effect the existing features of dropdown widget. If the user needs to enable local search with remote API data, then simply set the localSearch setting to true as follow:

$modelDropdown.dropdown({
  apiSettings: {
    url: '/api/data.json'
  },
  fields: {
    name  : 'name', // displayed dropdown    
    value : 'id'         // actual dropdown value
  },
  localSearch: true,  // explicitly enable local search when needed
});

@jlukic jlukic added this to the 2.2.7 milestone Dec 18, 2016
@jlukic jlukic merged commit 634d2e0 into Semantic-Org:next Dec 27, 2016
jlukic added a commit that referenced this pull request Dec 28, 2016
@jlukic
Copy link
Member

jlukic commented Dec 28, 2016

I've written new docs to distinguish between modes of API dropdown usage (filter remote vs filter local)
Semantic-Org/Semantic-UI-Docs@6bfe86f

@enix223
Copy link
Contributor Author

enix223 commented Dec 29, 2016

pretty cool.. thank you for your effort...

@jlukic
Copy link
Member

jlukic commented Dec 29, 2016

Thank you of course 👍

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

Successfully merging this pull request may close these issues.

3 participants