Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QSelect - Selecting option after filtering example doesn't work #12371

Closed
jeroenqui opened this issue Feb 6, 2022 · 2 comments
Closed

QSelect - Selecting option after filtering example doesn't work #12371

jeroenqui opened this issue Feb 6, 2022 · 2 comments

Comments

@jeroenqui
Copy link
Contributor

jeroenqui commented Feb 6, 2022

Description

The second example (Autoselect after filtering) is not working.
This is because ref.optionIndex in the code (see below) returns undefined

// "ref" is the Vue reference to the QSelect
ref => {
   if (val !== '' && ref.options.length > 0 && ref.optionIndex === -1) {
      ref.moveOptionSelection(1, true) // focus the first selectable option and do not update the input-value
      ref.toggleOption(ref.options[ ref.optionIndex ], true) // toggle the focused option
   }
}

Documentation Section URL

https://quasar.dev/vue-components/select#example--selecting-option-after-filtering

Flavour

Quasar CLI (@quasar/cli | @quasar/app)

Areas

Components (quasar)

@rstoenescu
Copy link
Member

Thanks for reporting this.
New method will be available for QSelect -> getOptionIndex()

@lxmfly123
Copy link
Contributor

In latest Quasar release for now(v2.5.5), this method is getOptionIndex: (index: number) => void;, it should be getOptionIndex: () => number.

athisun added a commit to athisun/quasar that referenced this issue Feb 19, 2022
yusufkandemir pushed a commit that referenced this issue Feb 21, 2022
Co-authored-by: Andrew Carr <acarr@integral.com.au>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants