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

typeahead render event #1444

Open
frechina opened this issue Dec 9, 2015 · 4 comments
Open

typeahead render event #1444

frechina opened this issue Dec 9, 2015 · 4 comments

Comments

@frechina
Copy link

frechina commented Dec 9, 2015

I am trying to use the typeahead render event, but can't get the arguments passed in correctly.

.on('typeahead:render', function (event, items, isAsync, datasetName) {
                    console.log(event);
                    console.log(items);
                    console.log(isAsync);
                    console.log(datasetName);
});

The render event files when expected, but it's not passing the arguments correctly.

event variable is the jQuery event object as specified.. But, I'd expect the second argument, items variable to be an array containing the current suggestions, but it only contains the first suggestion.. The next two arguments contain the 2nd and 3rd suggestions, and not the async flag, and dataset name as expected.

@heacu
Copy link

heacu commented Dec 15, 2015

i just noticed this, too. perhaps it has been solved already. see #1206, #1207.

for now if you want the suggestions you can do:

x.bind('typeahead:render',
                function (ev) {
                    var suggestions = Array.prototype.slice.call(arguments, 1);
                }
            );

the async and datasets arguments appear to be completely missing.

@leizard
Copy link

leizard commented Aug 17, 2016

I met the same problem. Is it a bug ?

@jlbooker
Copy link
Contributor

A fix for this is now merged over in corejavascript/typeahead.js#65

@aaaa0441
Copy link

Since this repo seems not being maintained. I've switched to the forked corejavascript/typeahead.js repo, which contains the fix.

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

5 participants