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

Load search results in javascript #154

Open
tacman opened this issue Sep 19, 2019 · 2 comments
Open

Load search results in javascript #154

tacman opened this issue Sep 19, 2019 · 2 comments

Comments

@tacman
Copy link

tacman commented Sep 19, 2019

It is possible to skip the ajax request and simply return the data via a function? I already have my tags loaded into javascript, and would like to just loop through them and return the valid ones. That would skip the sometimes-slow AJAX call, especially when someone starts to type a few letters and it makes several calls.

Thanks.

@DubbleClick
Copy link
Contributor

So you want local values? Or do you want local values that will be updated dynamically?

For the latter I've been thinking about implementing some kind of selector-based value loading system.

In your specific case however, I don't think you need this bundle at all. What you need is #68 (comment) with some extra javascript.

@tacman
Copy link
Author

tacman commented Mar 26, 2020

What I'd like to do is implement select2's ajax.processResults (https://select2.org/data-sources/ajax). In particular, I'd like to use API Platform to get my dropdown list, which returns values in JSON or JSON+LD. So I really just want to intercept the response and convert it to the array structure that select2entity expects.

Alas, I'm not a javascript expert, I'm guessing there's a way to overwrite the ajax parameters, but not sure how.

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

No branches or pull requests

2 participants