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 with q-toggle(q-checkbox too) doesn't check toggle option if model has saved value

    Framework
    2
    2
    513
    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.
    • A
      arwentank last edited by

      Q-select with q-toggle (q-checkbox too) doesn’t check toggle option if model has saved value.
      When you choose this option again - it will be duplicated in model.
      For me it seems like bug, but it isn’t and I just couldn’t find any good idea how to fix this. Thanks!

      Here is example https://codepen.io/taniadiachuk/pen/zYYJeZB

      f7e5d546-ec5e-4e36-90c9-6122d036cc9b-image.png

      2b2ce05f-f9f6-4785-953e-de08041be339-image.png

      1 Reply Last reply Reply Quote 0
      • C
        chyde90 last edited by chyde90

        There are two issues:

        1.) I think you meant to not set emit-value on your q-select, because your model is an array of objects (with label and value) when you initialize it.
        That causes the values (only the numbers) to be added to the model when you select an option.
        You can (should) either have your model hold values or objects.

        2.) To fix the syncronization between the q-select option and the q-toggle, you can replace your q-toggle with this:

        <q-toggle
           :value="scope.selected"
           @input="change => scope.toggleOption(scope.opt)"
        />
        
        1 Reply Last reply Reply Quote 0
        • First post
          Last post