I have a model product in which i want to filter it with it's user and I have used this code
filter :product_type_user_id_eq, as: :select, collection: -> {
User.all.map { |user| [user.name, user.id] }
}, label: 'User'
I have thousands of users so when I use the above code it takes time to load all the users. Is there any way that I can apply a search filter while typing. so the first step, loading all users can be eliminated and when I type something in the search filter it gives data users according to that.
I am not sure I understand you correct, but if your are searching for som attributes on users, you could try something like Stimulus Reflex. They have a nifty example of a use case that might suite you.
https://expo.stimulusreflex.com/demos/tabular
here you can cain your attributes
Make sure to index your query fields, for better performance
There are some Selectize based plugins that may help, eg. ActiveAdmin::AjaxFilter . See thewiki for others.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.