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

    Cancel QSelect Selection?

    Help
    2
    4
    198
    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.
    • haigha-earwicket
      haigha-earwicket last edited by

      Is there a way to be able to proactively cancel a selection in a q-select? So, the user selects something, a handler can do some checking, and the model gets changed ONLY if the handler approves; otherwise the model stays unchanged.

      I’ve googled, looked through the qselect code, and tried a few things like returning false from @input and adding a @change.native handler, but neither of those seem to work. I’ve also tried adding a rule, but that still allows the model to change even though I’m returning a string indicating an error.

      Thanks for any ideas!

      metalsadman 1 Reply Last reply Reply Quote 0
      • metalsadman
        metalsadman @haigha-earwicket last edited by metalsadman

        @haigha-earwicket use lazy model ie. :value="model" @input="handler", where you do the actual change in your handler. You didnt need to google far enough, vue docs explained it there how v-model works.

        haigha-earwicket 1 Reply Last reply Reply Quote 1
        • haigha-earwicket
          haigha-earwicket @metalsadman last edited by

          @metalsadman that worked like a charm, thanks! I figured it supported it somehow, but I just couldn’t see it since I didn’t know quite what I was looking for. I still don’t see anything on that page that describes how v-model works though, except a small snippet down in the API box that doesn’t really describe much of use in this case. Perhaps adding an example of this use case under “The Model” section would be helpful for those like me who are still learning the best way of using Quasar in their projects.

          metalsadman 1 Reply Last reply Reply Quote 0
          • metalsadman
            metalsadman @haigha-earwicket last edited by metalsadman

            @haigha-earwicket https://vuejs.org/v2/guide/components.html#Using-v-model-on-Components. v-model is equivalent (usually called a syntactic sugar) for/to :value="model" @input="model = $event".

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