-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[Request] Autocomplete extra parameter for server-side search #995
Comments
@dmig you can pass extra like this
|
@Mohanrau I need to pass extra data from component declaration, so your solution won't help. <template>
...
<q-autocomplete :min-characters="2" :max-results="10" @search="search_a" />
...
<q-autocomplete :min-characters="2" :max-results="10" @search="search_b" />
...
<q-autocomplete :min-characters="2" :max-results="10" @search="search_c" />
...
</template>
<script>
// ...
let search_methods = {};
['a', 'b', 'c'].forEach(n => {
search_methods['search_' + n] = (term, done) => {
Vue.http.get('/api/endpoint/{field}', {params: {term, field: n}})
.then(response => done(response.data), err => {
console.error(err)
done([])
})
}
})
// ...
methods: {
// ...
...search_methods
// ...
}
// ...
</script> Vue object as 3rd parameter to search handler would also help. |
<template>
<q-input>
<q-autocomplete @search="(terms, done) => mySearch(terms, done, 'field-name')" />
<!-- mySearch (terms, done, extra) -->
</q-input>
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Right now
@search
handler of QAutocomplete receives only 2 parameters: search term and done callback.I faced a situation, where I want to use one handler for multiple Autocomplete fields. The only thing I miss -- is the way to pass parameter to distinguish these fields.
E.g.:
The text was updated successfully, but these errors were encountered: