-
Notifications
You must be signed in to change notification settings - Fork 248
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
Limit number of results returned by lookup and auto load additional results when user scrolls to bottom of list #105
Comments
honestly I would build a custom interface for something like that. write a but also why do you say that it would return all the results ? it certainly On Fri Feb 06 2015 at 6:26:30 PM Carsten Klein [email protected]
|
Granted, however, entering a term of a min length of 1 and some common character like for example 'a' will return you most of your data from the server, especially when you look up multiple attributes in your model, e.g. first_name, last_name, country, city etc. Regardless of how the lookup is being implemented or however optimized the indexes are, this would, in our scenario, return approximately 10k+ results, which is unacceptable performance wise. The PR will eventually prevent such situations from ever occurring as it will incrementally load results from the server. Just have a look, the changes made are minimal and will not change the overall behaviour of the app/api. The PR needs some more work, of course. Scrolling down the displayed menu will fetch additional results as expected, however, the overall UX needs some more work. And using angular is not an option here, believe me, way too complicated for the folks responsible for implementing the application... |
https://github.com/crucialfelix/django-ajax-selects#plugin_options-property-default plugin options: minLength On Fri Feb 06 2015 at 11:12:18 PM Carsten Klein [email protected]
|
I know that, but not everyone likes to limit their searches by this option. In our use case, there is no restriction on minLength. |
then do it in your Lookup. if the query is only one char then just return YourModel.objects.none() |
Doing it in just the lookup will limit the results to an artificial limit and will not allow the user to retrieve more results from the same query by simply scrolling down the list. Alternatively you might want to google especially the one http://bugs.jqueryui.com/ticket/9651 which had been closed and leaves it to the users to write plugins, something which ajax-selects is. |
Doing it in the lookup requires an alternative implementation of the JQuery UI AutoComplete widget. I am currently working on this. I think that this issue can be closed. |
@crucialfelix
In our app we have > 100k names of persons that we would like to be able to search for using ajax_selects.
The current implementation would, in worst case scenarios, result in a major performance drop as the lookup would return far too many items.
I am currently working on a PR that will
I still need to flesh things out but I wonder whether such a PR would be appreciated and how soon it could be integrated into the master once all issues have been resolved.
Thanks!
The text was updated successfully, but these errors were encountered: