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



  • 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)?



  • 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



  • @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"
    


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

    Scott


Log in to reply