Open AngelGris opened 9 years ago
I think this is a significant bug, assume you set the limit to 15. You get 9 items from remote. The slice of 15-9 is 6, so only the first 6 will be used. Like what? :-1:
Yeah, a real problem. But switching those two lines of code to append first and only then increase the number of rendered hints solves it.
@jharding can we make a quick bug fix release with this?
Oh, shit! This bug have waste whole my afternoon...
This issue was not merged into the source files. Created PR for that: https://github.com/twitter/typeahead.js/pull/1420 I guess this would be later updated into the dist files, right?
The problem is that twitter/typeahead is no longer maintained. I too fixed this bug - see https://github.com/twitter/typeahead.js/pull/1416 - but there is a very long queue of pull requests. The new active project is https://github.com/corejavascript/typeahead.js
Oh! I though about that! but didn't find any notice about that! Maybe editing the readme?
macgyver solution is not correct, but it works = D puts limit: limit: 999999999999999999999999999999999 It worked with me because I'm taking data dynamically, so I limit the items in mysql select: $ animals = $ mysqli-> prepare ("SELECT id_tipo_venda, id, name, foto1, sex FROM animals WHERE name LIKE ORDER by name, id LIMIT 7");
Whatever you're trying to fix or work around has probably already been fixed on the active fork, which is over at https://github.com/corejavascript/typeahead.js
On 31 October 2015 at 13:19, AdmirTomaz notifications@github.com wrote:
macgyver solution is not correct, but it works = D puts limit: limit: 999999999999999999999999999999999 It worked with me because I'm taking data dynamically, so I limit the items in mysql select: $ animals = $ mysqli-> prepare ("SELECT id_tipo_venda, id, name, foto1, sex FROM animals WHERE name LIKE ORDER by name, id LIMIT 7");
— Reply to this email directly or view it on GitHub https://github.com/twitter/typeahead.js/issues/1299#issuecomment-152734919 .
No, I tested this, I saw that you had posted above, the js are the same as I had here, it is the same way =(
Sorry, didn't realise it was the same thread.
if they find a better solution, please let here. =D
The corejs fork has updated it in master, but they haven't pushed up a new version yet so if you do a straight bower install you'll get the same behavior. See: https://github.com/corejavascript/typeahead.js/commit/a52bd457977fae264d1f90564bfa1fbddbbf7c9d
Hi guys! Is it resolved already?
When getting remote hints, if the number of hints equals (limit - rendered) since in typeahead.bundle.js line 1723 it runs:
So if the number of hints equals (limit - rendered) then it'll append an empty array (suggestions.slice(0, 0)). To prevent this just switch those two lines so that it first appends the suggestions and only then increases the number of rendered hints: