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

    [SOLVED] Scroll q-select dropdown options on specific value

    Framework
    2
    4
    781
    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.
    • dmitry.polushkin
      dmitry.polushkin last edited by dmitry.polushkin

      I would like to show middle of the dropdown selection of a q-select options before it will have any selected value.
      Is there are any internal mechanism to scroll dropdown selection to a specific value in the select when it was just initialized (without value)?

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

        If you use the virtual scroll there is the method scrollTo(). Not sure that is exactly what you need, as I’ve never used it, but it sounds close. 🙂

        Scott

        1 Reply Last reply Reply Quote 0
        • dmitry.polushkin
          dmitry.polushkin last edited by

          @s-molinari thanks for suggesting. Checked the source code and there are already a solution using the function moveOptionSelection.

          So in total place this into a method:

                if (!this.$refs.startTime.value) {
                  this.$nextTick(() => {
                    this.$refs.start.moveOptionSelection(20, false)
                  })
                }
          

          And call it from select:

          
                    ref="startTime"
                    @popup-show="setStartTimeToMiddle"
          
          1 Reply Last reply Reply Quote 0
          • s.molinari
            s.molinari last edited by

            Awesome! I should have scrolled down the methods further. 😊

            Scott

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