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.

Feature request: Autocomplete with dynamic loading/remote data source

See original GitHub issue

Currently the component v-select, with the autocomplete directive, allows the selection of items within a specific list (defined in the items property).

In some cases there are many records to be listed, which may be maintained in a server, e.g. select a student from hundreds students enrolled in a course. In this case, the input text should be used to filter all the student records in the server by name, optinally with additional parameters (ex. the course selected).

This feature is present in many libraries, as JQuery: https://jqueryui.com/autocomplete/#remote

I’m attaching to the request my AutoComplete component, which I implemented by extending Vuetify Select.

AutoComplete.zip

Example of use:

<auto-complete label="Student" v-model="exam.student" required
    prepend-icon="person" :disabled="!exam.course" 
    data-url="students" :data-params="{ course: exam.course }" data-post 
    item-text="name" item-value="id">

Please note that I’m using vue-resource and the url informed “students” is combined with the server root (http://www.myserver.com/ws/).

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:11
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

12reactions
Darkside73commented, Aug 6, 2017

I use autocomplete with remote data fetching by utilizing input.native and debounce use input:

<template>
  <v-select
    v-model="state"
    label="Select"
    :items="states"
    @input.native="loadStates"
    autocomplete
  ></v-select>
</template>

<script>
import debounce from 'debounce'

export default {
  data () {
    return {
      state: null,
      states: []
    }
  },
  methods: {
    loadStates: debounce((event) => {
      if (event.target.value.length > 2) {
        axios.get(`/api/states?q=${event.target.value}`).then(({ data }) => {
          this.states = data
        })
      }
    }, 200)
  }
}
</script>
1reaction
johnleidercommented, Sep 11, 2017

0.15.3 saw a massive improvement to the tools available for asynchronous item loading. Going to consider this resolved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

jquery autocomplete dynamic source from data attribute
A response callback, which expects a single argument: the data to suggest to the user. This data should be filtered based on the...
Read more >
Minimal Autocomplete Plugin For Dynamic Data - jQuery Script
A small, easy-to-use, AJAX-enabled jQuery autocomplete plugin that enables autocomplete suggestions for normal input fields using dynamic ...
Read more >
How to implement autocomplete with JavaScript on your website
Go deep into autocomplete - the what and why, and the data and code to implement ... Federated search: query multiple dynamic data...
Read more >
Multiple AutoComplete with dynamic data bindind - Telerik
I have a textbox where the user can enter multiple partnumbers (as comma separated) and the partnumber should have the autocomplete feature ......
Read more >
JavaScript Autocomplete TextBox (autosuggest) from Database
For loading remote data dynamically, the source possibility is either files or databases. This article uses the database as a source to have ......
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