Skip to content

List method always gets the previous model value #531

Description

@zhukovsergei

I'm submitting a ...

  • [x ] bug report
  • [x ] support request

What is the current behavior?

The list :list="getSuggestionList" method is called before the model data have been set

Maybe I do something wrong but:

  <vue-simple-suggest
      v-model="chosen"
      display-attribute="name"
      value-attribute="url"
      :list="getSuggestionList"
      @select="handleSelectedTask"
      ref="taskSelectorComponent"
  >

methods:

  getSuggestionList() {
console.log(this.chosen);
      if(this.chosen.length < 2) {
          return [];
      }

      return axios.get(`/api/reports/search-list/${this.chosen}`)
          .then(response => {
              return response.data;
          });
  },

When I start to type console.log(this.chosen); in getSuggestionList method I'm getting previous value.

e.g. Real typed: 1234
on console: 123

Is it possible make ajax request with actual data? The event @request-start has an actual parameter value but how to set the ajax result into suggested list?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions