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

    Q select (dynamic values for option)

    Framework
    3
    5
    5233
    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.
    • L
      lavanya27 last edited by

      How to bind the dynamic values for “options” in “q -select” component from the back end ? how to proceed further ?

      1 Reply Last reply Reply Quote 0
      • M
        Max last edited by

        your would need to send an ajax request to your backend
        and then assign those values from the response to your data part.

        1 Reply Last reply Reply Quote 0
        • L
          lavanya27 last edited by

          the problem is with binding the values from backend to “:options” in qselect ? how to proceed in this

          1 Reply Last reply Reply Quote 0
          • M
            Max last edited by Max

            you would need an ajax library like axios:
            check this:
            http://quasar-framework.org/guide/ajax-requests.html

            this.$http.get('/user')
              .then(function (response) {
                this.data.options = response.data
              })
            

            as an example…

            1 Reply Last reply Reply Quote 0
            • benoitranque
              benoitranque last edited by Max

              To expand on what @Max said:

              <template>
                <div>
                  <q-select v-model="value" :options="options"></q-select>
                </div>
              </template>
              
              <script>
                import { QSelect } from 'quasar'
                export default {
                  components: {
                    QSelect
                  },
                  data() {
                    return {
                      options: [],
                      value: ''
                    }
                  },
                  mounted () {
                    this.$http.get('/Route')
                      .then(response => {
                        this.options = response.data
                      })
                  }
                }
              </script>
              
              1 Reply Last reply Reply Quote 2
              • First post
                Last post