Quasar: [REQUEST] Please add "filter-method" into q-select with filter

Created on 25 Aug 2018  路  5Comments  路  Source: quasarframework/quasar

Hi eveyone, I am using q-select component and i'd like to import data from server so everytime user type into searchbox it makes a ajax call and receive the filtered selectable list. I don't know if there's a way to achieve it right know, if there is i'd appretiate any help.

However would be great adding this filter-method as prop, q-table already has it.

Software version

JsFiddle (for Quasar v0.15+ only) https://jsfiddle.net/leoprada/8kvt40u5/

What did you get as the error?

What were you expecting?

What steps did you take, to get the error?

Most helpful comment

Hi,

filter prop can be a Function too. Example:

// <q-select :filter="myFilter" ....

function myFilter (terms, obj) {
  return obj.label.toLowerCase().indexOf(terms) > -1
}

Updated docs.

All 5 comments

I believe this is similar to: https://github.com/quasarframework/quasar/issues/2435

Scott

Hi,

filter prop can be a Function too. Example:

// <q-select :filter="myFilter" ....

function myFilter (terms, obj) {
  return obj.label.toLowerCase().indexOf(terms) > -1
}

Updated docs.

@rstoenescu thank you for answering, I hadn't noticed it was possible, even though I tested it and don't gives the option of modifying the complete method, just lets modify the rule inside an already running .filter() bucle of an already formed array. As i said i was expecting to make an ajax call THEN filter the response and return the filtered object. Do you know any way to achieve it?

I also miss this function in q-select. Would be very usefull if implemented!
For large amount of data the component take a few seconds to show the options. With ajax it would be more user friendly and smooth.

I have an example describing the problem: https://github.com/quasarframework/quasar/issues/943#issuecomment-429610400

Was this page helpful?
0 / 5 - 0 ratings