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
    1. Home
    2. steve0304
    S
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 4
    • Best 1
    • Groups 0

    steve0304

    @steve0304

    1
    Reputation
    1
    Profile views
    4
    Posts
    0
    Followers
    0
    Following
    Joined Last Online
    Location Pécs Age 31

    steve0304 Follow

    Best posts made by steve0304

    • RE: How to adjust map-options select field default value?

      I found the solution. Ned a parseInt When mapping the array.
      Change

      this.statusOptions = Object.entries(data.statusOptions).map(key => ({id: key[0], name: key[1]}))
      

      to

      this.statusOptions = Object.entries(data.statusOptions).map(key => ({id: parseInt(key[0]), name: key[1]}))
      

      Codepen: https://codepen.io/steve0304/pen/yLVbEee

      posted in Help
      S
      steve0304

    Latest posts made by steve0304

    • RE: How to adjust map-options select field default value?

      I found the solution. Ned a parseInt When mapping the array.
      Change

      this.statusOptions = Object.entries(data.statusOptions).map(key => ({id: key[0], name: key[1]}))
      

      to

      this.statusOptions = Object.entries(data.statusOptions).map(key => ({id: parseInt(key[0]), name: key[1]}))
      

      Codepen: https://codepen.io/steve0304/pen/yLVbEee

      posted in Help
      S
      steve0304
    • RE: How to adjust map-options select field default value?

      @metalsadman
      I get an object from server and I create an array from the object to the select input options.
      Here is the codepen. https://codepen.io/steve0304/pen/mdOmpKx

      posted in Help
      S
      steve0304
    • RE: How to adjust map-options select field default value?

      @dobbel
      Thanks for the reply, but this was not the question. Sorry, I did not copy the full code, because it’s not relevant to the question.
      this is the full data function if you are interested:

      data() {
          return {
            id: null,
            apiUrl: '/user/update',
            errors: null,
            data: {},
            form: {
              email: '',
              phone: '',
              status: ''
            },
            inputError: {
              email: '',
              phone: '',
              status: ''
            },
            statusOptions: []
          }
        },
      

      This part is works. the question is about the select input.
      I get the select input options from server:Képkivágás.PNG

      And I get the exists user data:
      tempsnip.png

      You can see the status is 1. So when I want to set the user status to the select input I see 1 not “Active” but when I change status the label is ok.
      Névtelen.png

      I hope you understand my problem.

      posted in Help
      S
      steve0304
    • How to adjust map-options select field default value?
      <q-select
                    outlined
                    v-model="form.status"
                    :options="statusOptions"
                    @blur="inputValidate('status')" :error="inputError.status !== ''"
                    :error-message="inputError.status"
                    label="Státusz"
                    emit-value
                    map-options
                    dense="dense"
                    options-dense
                    option-value="id"
                    option-label="name"
                  />
      
      data() {
          return {
            form: {
              email: '',
              phone: '',
              status: ''
            },
            statusOptions: []
          }
        },
      
      async mounted() {
          this.$q.loading.show()
          this.id = this.$route.params.id
          this.apiUrl += '?id=' + this.id
      
          const {
            status,
            data
          } = await httpClient.get(this.apiUrl)
      
          if (status === 200) {
            this.data = data.model
            this.statusOptions = Object.entries(data.statusOptions).map(key => ({id: key[0], name: key[1]}))
            formService.load(this.form, data.model)
          }
      
          this.$q.loading.hide()
        },
      

      I get the select field options list from server and I get the old values from the server too. I use key value pair in select options. From the server I get a number as selected value. How can I adjust it to my select input?

      posted in Help
      S
      steve0304