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

Add an 'initialQuery' option when using ajax and you initially click the widget #24

Closed
ProLoser opened this issue Apr 10, 2012 · 3 comments
Labels

Comments

@ProLoser
Copy link
Contributor

I had to implement this for ajax-chosen on iceslice.

When you click on the chosen widget initially, if it contains no values you can type in a search string which it uses. However, it should also be capable of doing an iniitial query, such as to request the first 10 or 50 entries from the system. If you could continue in this manner to scroll too, that would be good, but not necessarily critical.

Perhaps an initial query might not even be necessary. Perhaps you can support merging both queried results AND initial results (when the page loads).

@ivaynberg
Copy link
Contributor

this is how select2 already works. when it is opened updateResults() method is called which performs the query.

if you want to "merge" initial data with further-loaded remote data you should probably roll your own query() function and handle it within that.

i know @justindujardin was working on something similar, maybe he can give you some pointers.

@ProLoser
Copy link
Contributor Author

I'm talking about it showing the first n rows without typing in anything

Sent via Hubroid

@ivaynberg
Copy link
Contributor

i think we are talking about the same thing. this is, for example, how Select2 shows all the select choices when it is first opened - the query function matches all options when search is empty.

so, if you do not set the minimumInputLength parameter, or set it to zero, query() is called when the select2 is opened and returned choices will be displayed right away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants