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

Bloodhound discards suggestions fetched from remote #1768

Closed
JakupGuven opened this issue Aug 8, 2019 · 2 comments
Closed

Bloodhound discards suggestions fetched from remote #1768

JakupGuven opened this issue Aug 8, 2019 · 2 comments

Comments

@JakupGuven
Copy link

JakupGuven commented Aug 8, 2019

I have an issue with a specific search string where Bloodhound receives four elements from remote that I'd like to have displayed as suggestions.

Instead only one suggestion is displayed.

I can tell that the elements are actually received by Bloodhound by making a custom transform simply displaying the response.
However when I don't define a custom transform some where along the way the would-be suggestions dissappear.

UPDATE:
After further debugging I've discovered that the elements are still present after
function processRemote(remote)
is called.

source: new Bloodhound({
                        datumTokenizer: Bloodhound.tokenizers.obj.whitespace('Title'),
                        queryTokenizer: Bloodhound.tokenizers.whitespace,
                        remote: {
                            url: '/api/suggest/' + p + '/%QUERY',
                            wildcard: '%QUERY',
                            //transform: function (response) {
                            //    console.log(response)
                            //}
                        },

                    }),
                    templates: {
                        header: '<h3 class="league-name">' + data[p].charAt(0).toUpperCase() + data[p].slice(1) + '</h3>',
                        suggestion: function (d) {
                            return "<a href=" + d.Url + "><span>" + d.Title + "</span></a>"
                        }
                    }
                };

Did anyone experience similar issues?
How can I solve this?

@JakupGuven
Copy link
Author

results
These are the elements.
Only the first one ends up being displayed.

@JakupGuven
Copy link
Author

It was the same issue as this PR from 2016 addresses
#1566

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

No branches or pull requests

1 participant