No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Getting error while doing Autocomplete..

    Help
    3
    8
    746
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      radhika248 last edited by

      <q-select
      outlined
      v-model=“country”
      :options=“country_data”
      :option-value=“opt => opt.id”
      :option-label=“opt => opt.name”
      emit-value
      map-options
      fill-input
      use-input
      @filter=“filterFn”
      style=“max-width: 300px”
      :rules="[val => !!val || ‘Field is required’]"
      ></q-select>
      I have used this function:
      filterFn (val, update, abort) {
      update(() => {
      const needle = val.toLowerCase()
      this.options = this.country_data.filter(v => v.toLowerCase().indexOf(needle) > -1)
      })
      }
      [Vue warn]: Error in v-on handler: “TypeError: v.toLowerCase is not a function”
      TypeError: v.toLowerCase is not a function

      1 Reply Last reply Reply Quote 0
      • s.molinari
        s.molinari last edited by

        What is in country_data?

        Scott

        1 Reply Last reply Reply Quote 0
        • R
          radhika248 last edited by

          There is a data fetched by API

          1 Reply Last reply Reply Quote 0
          • s.molinari
            s.molinari last edited by

            And what is the data in that variable???

            Scott

            1 Reply Last reply Reply Quote 0
            • R
              radhika248 last edited by

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • R
                radhika248 last edited by

                0:
                id: 1
                name: “India”
                I got id as 1 and name as India.

                metalsadman 1 Reply Last reply Reply Quote 0
                • metalsadman
                  metalsadman @radhika248 last edited by

                  @radhika248 on line this.options = this.country_data.filter(v => v.toLowerCase().indexOf(needle) > -1), if it’s an object then you’ll have to get the key ie. this.options = this.country_data.filter(v => v.name.toLowerCase().indexOf(needle) > -1) and i think your :options=“country_data” props should take :options=“options” instead. next time pls use tripple back ticks "`" for code blocks, and provide valid info, like on your last comment
                  @radhika248 said in Getting error while doing Autocomplete..:

                  0:
                  id: 1
                  name: “India”
                  I got id as 1 and name as India.

                  it’s not clear if your data is object or whatnot.

                  1 Reply Last reply Reply Quote 0
                  • R
                    radhika248 last edited by

                    Thank you.And the issue i was facing is now solved 🙂

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post