GithubHelp home page GithubHelp logo

async autocomplete about vue-excel-editor HOT 8 CLOSED

cscan avatar cscan commented on July 24, 2024
async autocomplete

from vue-excel-editor.

Comments (8)

cscan avatar cscan commented on July 24, 2024

type='select' should address your needs. Its prop "options" supports the async function, or your function return a promise, something like this:

<vue-excel-column field="x" label="Test" type="select" :options="getXOptions" />
methods: {
   async getXOptions () {
      const result = await getXFromServer()
      return result
   }
}

from vue-excel-editor.

isbincApps avatar isbincApps commented on July 24, 2024

thanks @cscan, but If I want to type something and make async filter, what I have to do?

from vue-excel-editor.

cscan avatar cscan commented on July 24, 2024

type="select" supports typing. The dropdown list depends on your async function. Component will pass the edit value and record to the function, you may try this:

methods: {
   async getXOptions (val, rec) {
      if (val === '') return []
      const result = await getXFromServer(val) // val contains what you typed
      return result
   }
}

from vue-excel-editor.

isbincApps avatar isbincApps commented on July 24, 2024

awesome, thank you very much

from vue-excel-editor.

isbincApps avatar isbincApps commented on July 24, 2024

it works, but why is so slow setting the value in the grid

from vue-excel-editor.

isbincApps avatar isbincApps commented on July 24, 2024

is there any possibility to set a debounce function in async getXOptions (val, rec)

from vue-excel-editor.

cscan avatar cscan commented on July 24, 2024

Slow because of the await. You may add some caching to speed the things up.

from vue-excel-editor.

isbincApps avatar isbincApps commented on July 24, 2024

I'm trying to do something like like this, but i'm getting

list.slice is not a function
async getXOptions () { if (val === '') return [] return debounce(async () => await getXFromServer(), 500) }

from vue-excel-editor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.