Search code examples
teleriknativescriptnativescript-vue

How to set initial value for radautocomplete in nativescript?


Here is What I'm doing: Template:

      <RadAutoCompleteTextView
        class="autocomplete"
        :items="regions"
        loaded="onLoaded"
        completionMode="Contains"
        @textChanged="textChanged"
        returnKeyType="done"
      />

Script:

      onLoaded() {
        this.$refs.autocomplete.addToken(
          new TokenModel(this.$store.state.profile.region),
        );
      },

But it doesn't work, as in, I don't get any preselected value for region. I'm using nativescript-vue, How can I get a preselected value for my autocomplete?


Solution

  • I think you should add a @ to loaded because it is an event. The onLoaded function should work as it is correctly adding a new token.